snakey wrote: > > Hi Fredrik, > Thanks for the suggestion. Let me try it now. I guess I need a deeper > understanding of this mainloop() thing. I am still unclear about how the > whole GUI concept of mainloop() works. >
Fredrik Lundh wrote: > > Snakey wrote: > >> I have created a simple Tkinter GUI. I have a function that needs to be >> executed automatically upon launching the GUI application. How can it be >> done? > > how about calling it from the script that creates the GUI, before you > enter the mainloop? > > my_function() > root.mainloop() > > if you want to call it when the GUI is up and running, you can use the > "wait_visibility" method on the root widget: > > root.wait_visibility() # run event loop until window appears > my_function() > root.mainloop() > > another approach is to use the "after_idle" method: > > root.after_idle(my_function) > root.mainloop() > > </F> > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss@python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -- View this message in context: http://www.nabble.com/How-to-automatically-run-some-code-upon-GUI-startup--tp16547636p16577829.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss