[Tkinter-discuss] How to launch a dialog when app is started?
russblau at hotmail.com
Thu Mar 2 22:14:54 CET 2006
I am trying to write a Tkinter application that will automatically display a
particular dialog box on top of the application when it is initialized.
(Like a word processor opening a "File Open" dialog as the first thing that
happens when you enter the application.) How do I do this? I have a method
that invokes the dialog box, but I cannot call it until after my app's
mainloop has started; but once the mainloop has started, I can't call it
from the program, either!
I'm sure I'm overlooking something obvious here.
Example (skeleton) code:
from Tkinter import *
def body(self, master, title="Select Target"):
Label(master, text="Target page:").grid(row=0)
self.targetpage = Entry(master)
def __init__(self, master):
n = NewPageDialog(self)
self.targetpage = n.targetpage.get()
if __name__ == "__main__":
app = GuiApplication(Tk())
# do something here to cause GuiApplication to invoke newpage() method
when it starts
More information about the Tkinter-discuss