首页 > 其他 > 详细

GUI

时间:2016-02-22 16:33:44      阅读:104      评论:0      收藏:0      [点我收藏+]

图形界面

技术分享

from tkinter import *
import tkinter.messagebox as messagebox

class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack()
        self.createWidgets()

    def createWidgets(self):
        self.nameInput = Entry(self)
        self.nameInput.pack()
        self.alertButton = Button(self, text=Hello, command=self.hello)
        self.alertButton.pack()

    def hello(self):
        name = self.nameInput.get() or world
        messagebox.showinfo(Message, Hello, %s % name)

app = Application()
# 设置窗口标题:
app.master.title(Hello World)
# 主消息循环:
app.mainloop()

 

GUI

原文:http://www.cnblogs.com/jzm17173/p/5207385.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!