【发布时间】:2013-01-05 00:07:19
【问题描述】:
我对 Python 相当陌生,但我正在尝试使用 tkinter (Python 2.7.x) 制作一个简单的 gui。我有一个功能齐全的按钮,但我只能让脚本在 iPython 中工作。当我尝试在 iPython 环境之外运行它时,我看到一些文本在命令提示符下运行但没有任何反应(即没有 gui 出现,没有任何操作发生)。
我的代码:
import Tkinter
from Tkinter import *
import os
#define frame
root = Tk()
frame = Frame(root)
frame.pack()
#define buttons
button = Button(frame, text="Action", command= lambda: os.system("Action.py"))
button.pack(side=LEFT)
【问题讨论】:
标签: user-interface python-2.7 tkinter