简体   繁体   中英

Tkinter Gui does not appear

I'm trying to learning Python following a video Tutorial found on You Tube. The version of Python is 2.6.4 and the OS is Windows 10 64.bit.

Yesterday the tutorial face the creation of GUI.

The miminum instracion set is in a file:

   from Tkinter import *
   top = Tk()

Running this file in the Python shell of Windows a little window appares. Yestreday all was running correctly. The tutorial adds labels and button.

Today I restarted but running the same example the window does not apper.

Could you help me to understand what is wrong? Ther are some process open? I have to to some kind of restet.

Thank you

You forgot to start the Tkinter GUI. You should add .mainloop() for that. So:

from Tkinter import *
top = Tk()
top.mainloop()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM