简体   繁体   English

Tkinter Gui没有出现

[英]Tkinter Gui does not appear

I'm trying to learning Python following a video Tutorial found on You Tube. 我正在尝试根据You Tube上的视频教程学习Python。 The version of Python is 2.6.4 and the OS is Windows 10 64.bit. Python的版本为2.6.4,操作系统为Windows 10 64位。

Yesterday the tutorial face the creation of GUI. 昨天,本教程将面对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. 在Windows的Python shell中运行此文件会产生一个小窗口。 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. 您忘记了启动Tkinter GUI。 You should add .mainloop() for that. 您应该.mainloop()添加.mainloop() So: 所以:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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