Open jhi2 opened 4 weeks ago
Why does this happen? Help would be appreciated!
Code?
The code is incomplete but works
Code?
from google_auth_oauthlib.flow import Flow from tkinter import ttk import nativesvttk as nsv from pathlib import Path import tkinter as tk import webview from PIL import Image,ImageTk flow = Flow.from_client_secrets_file( f"{Path.cwd()}/googleapis.json", scopes=['openid', 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile'], redirect_uri=f'https://internalfiles.johnnytech.net/signme/return.html') def window(window: tk.Tk, image, header, text, btn, btncommand): img = Image.open(image) width, height = img.size
# Adjust the window size based on the image dimensions
window_width = width + 100 # Add some padding
window_height = height + 200 # Add some padding for the header, text, and button
window.geometry(f"{window_width}x{window_height}")
nsv.native_theme(window)
hdr_font = ("Helvetica", 16, "bold")
hdr = ttk.Label(window, text=header, font=hdr_font)
hdr.pack()
imgtk = ImageTk.PhotoImage(img)
imglbl = ttk.Label(image=imgtk)
imglbl.pack()
txtlbl = ttk.Label(text=text)
txtlbl.pack()
button = ttk.Button(text=btn, command=btncommand)
button.pack()
window.mainloop()
def window1cmd(window1): window1.destroy() webview.create_window("Sign In with Google",flow.authorization_url()[0]) webview.start() window1 = tk.Tk() window(window1,f"{Path.cwd()}\image.png","SignMe","Sign your apps FAST with SignMe!\n Sign In with Google to get started.","Sign In",lambda:window1cmd(window1))
Can you try it with plain sv-ttk? I don't know what exactly nsvttk does.
nativesvttk
is my fork of the repo (Remember the PR?) . It would be lisht mode.
so, with sv_ttk
it would be:
from google_auth_oauthlib.flow import Flow
from tkinter import ttk
import sv_ttk
from pathlib import Path
import tkinter as tk
import webview
from PIL import Image,ImageTk
flow = Flow.from_client_secrets_file(
f"{Path.cwd()}/googleapis.json",
scopes=['openid', 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile'],
redirect_uri=f'https://internalfiles.johnnytech.net/signme/return.html')
def window(window: tk.Tk, image, header, text, btn, btncommand):
img = Image.open(image)
width, height = img.size
# Adjust the window size based on the image dimensions
window_width = width + 100 # Add some padding
window_height = height + 200 # Add some padding for the header, text, and button
window.geometry(f"{window_width}x{window_height}")
sv_ttk.set_theme(window,"light")
hdr_font = ("Helvetica", 16, "bold")
hdr = ttk.Label(window, text=header, font=hdr_font)
hdr.pack()
imgtk = ImageTk.PhotoImage(img)
imglbl = ttk.Label(image=imgtk)
imglbl.pack()
txtlbl = ttk.Label(text=text)
txtlbl.pack()
button = ttk.Button(text=btn, command=btncommand)
button.pack()
window.mainloop()
def window1cmd(window1):
window1.destroy()
webview.create_window("Sign In with Google",flow.authorization_url()[0])
webview.start()
window1 = tk.Tk()
window(window1,f"{Path.cwd()}\\image.png","SignMe","Sign your apps FAST with SignMe!\n Sign In with Google to get started.","Sign In",lambda:window1cmd(window1))
Can you try to use sv-ttk==2.5.5 to test again? I think there is something wrong in 2.6.0.
Can you try to use sv-ttk==2.5.5 to test again? I think there is something wrong in 2.6.0.
Thanks. I'll try that.