-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sv_ttk
doesn't work with multiple tkinter.Tk
instances
#36
Comments
Hi! Can you please clarify what you mean by multi form? And maybe can you attach some example code so I can see where the problem might be? |
Thank for your help.
import tkinter as tk
from tkinter import ttk
import sv_ttk
MainWindow = tk.Tk()
sv_ttk.use_dark_theme( )
MainWindow.title('Foundation Input')
screen_w = MainWindow.winfo_screenwidth()
screen_h = MainWindow.winfo_screenheight()
form_w = 900
form_h = 600
x = int(screen_w / 2) - int(form_w / 2)
y = int(screen_h / 2) - int(form_h / 2)
MainWindow.geometry('%dx%d+%d+%d' % (form_w, form_h, x, y))
MainWindow.resizable(False, False)
ButtonFrame = ttk.LabelFrame(MainWindow, text="Foundation type", padding=(20, 10))
ButtonFrame.place(x=130, y=130)
LeftVar = tk.IntVar()
RightVar = tk.IntVar()
nextvar = tk.IntVar()
def clear_left():
LeftVar.set(0)
def clear_right():
RightVar.set(0)
def t2():
MainWindow.destroy()
import twoped
LeftPic = tk.PhotoImage(file='left.png')
RightPic = tk.PhotoImage(file='right.png')
left_pick = ttk.Checkbutton(ButtonFrame, variable=LeftVar, image=LeftPic, style="Toggle.TButton",
command=clear_right)
left_pick.grid(column=0, row=0, padx=15, pady=20, sticky="nsew")
left_lable = ttk.Label(ButtonFrame, text="2 Pedstall Foundation", font=('cambria'))
left_lable.grid(column=0, row=1)
right_pick = ttk.Checkbutton(ButtonFrame, variable=RightVar, image=RightPic, style="Toggle.TButton",
command=clear_left)
right_pick.grid(column=2, row=0, padx=15, pady=20, sticky="nsew")
right_lable = ttk.Label(ButtonFrame, text="4 Pedstall Foundation", font=('cambria'))
right_lable.grid(column=2, row=1)
next_button = ttk.Button(ButtonFrame, text="Nex Step", style="Accent.TButton",command=t2)
next_button.grid(column=1, row=2, pady=10, padx=10)
MainWindow.mainloop()
import tkinter as tk
from tkinter import ttk, Tk
import sv_ttk
TwoPedWindow: Tk = tk.Tk( )
sv_ttk.use_dark_theme( )
TwoPedWindow.title('2 Pedstall window')
screen_w = TwoPedWindow.winfo_screenwidth()
screen_h = TwoPedWindow.winfo_screenheight()
form_w = 900
form_h = 600
x = int(screen_w / 2) - int(form_w / 2)
y = int(screen_h / 2) - int(form_h / 2)
TwoPedWindow.geometry('%dx%d+%d+%d' % (form_w, form_h, x, y))
TwoPedWindow.resizable(False, False)
var1 = tk.StringVar( )
var2 = tk.StringVar( )
def s2et():
a = var2.get( )
var1.set(a)
b1 = ttk.Button(TwoPedWindow, text="set", command=s2et).pack(side='top')
text1 = ttk.Entry(TwoPedWindow, textvariable=var2).pack(side='top')
Lable1 = ttk.Label(TwoPedWindow, textvariable=var1).pack(side='top') |
@rdbende can you help me? |
This isn't a bug with the theme, but rather a common Tkinter mistake. PS: (I hope this makes any sense) |
sv_ttk
doesn't work with multiple tkinter.Tk
instances
hi . When I want to create several forms, the theme is only applied to one of them.
The text was updated successfully, but these errors were encountered: