Python3.4 GUI界面教程(菜单栏)

from tkinter import *
def hello():
    print('hello')
def about():
    label = Label(root, text='王小涛_同學\n QQ:*********', fg='red', bg='black')
    label.pack(expand=YES, fill=BOTH)
root = Tk()
menubar = Menu(root)
filemenu = Menu(menubar, tearoff=0)
filemenu.add_command(label='打开', command=hello)
filemenu.add_command(label='保存')
filemenu.add_separator()
filemenu.add_command(label='退出', command=root.quit)
menubar.add_cascade(label='文件', menu=filemenu)
helpmenu = Menu(menubar, tearoff=0)
helpmenu.add_command(label='关于作者', command=about)
menubar.add_cascade(label='关于', menu=helpmenu)
root.config(menu=menubar)
root.geometry('200x400')
root.mainloop()

转载请注明作者与出处:http://blog.csdn.net/u013511642   王小涛_同學


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值