rdbende / Sun-Valley-ttk-theme

A gorgeous theme for Tkinter/ttk, based on the Sun Valley visual style ✨
https://pypi.org/project/sv-ttk
MIT License
1.79k stars 106 forks source link

Gray background while in light mode #140

Open jhi2 opened 4 weeks ago

jhi2 commented 4 weeks ago

image Why does this happen? Help would be appreciated!

rdbende commented 4 weeks ago

Code?

jhi2 commented 3 weeks ago

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))

rdbende commented 3 weeks ago

Can you try it with plain sv-ttk? I don't know what exactly nsvttk does.

jhi2 commented 3 weeks ago

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))
littlewhitecloud commented 1 week ago

Can you try to use sv-ttk==2.5.5 to test again? I think there is something wrong in 2.6.0.

jhi2 commented 1 week ago

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.