python - Tkinter: set method does not work in a function for toplevel window -
for reason, var.set(str) not update var when toplevel window created function. code below works when placed in mainloop (without function), though. when adding mainloop function works intended. intended behaviour?
from tkinter import * tkinter import ttk root = tk() def function(): mainframe = ttk.frame(root) mainframe.grid(column =1, row =1) configurewindow = toplevel(mainframe) pathinfocontent = stringvar() graphpathframe = ttk.frame(root) graphpathframe.grid(column = 1, row =1) graphpathlabel = ttk.label(graphpathframe, text = 'graphviz installation path:') graphpathlabel.grid(column = 1, row =1) graphpathlabel3 = ttk.label(graphpathframe, textvariable = pathinfocontent) graphpathlabel3.grid(column = 2, row =1) pathinfocontent.set('something') function() mainloop()
Comments
Post a Comment