pythonTKinter普通菜单的介绍
pythonTKinter普通菜单的介绍
TKinter中的菜单种类比较多,本篇就其中的普通菜单为大家带来讲解。
1、第一个Menu类定义是parent。
2、add_command添加菜单项,如果菜单是顶层菜单,从左到右添加,否则就是下拉菜单。
3、-label:指定菜单项名称、-command:点击后相应的调用函数、-acceletor:快捷键。
实例
#普通菜单案例
importtkinter
baseFrame=tkinter.Tk()
menubar=tkinter.Menu(baseFrame)
foritemin['File','Edit','View','Aboyt']:
menubar.add_command(label=item)
baseFrame['menu']=menubar
baseFrame.mainloop()
以上内容为大家介绍了python培训之TKinter普通菜单的介绍,希望对大家有所帮助,如果想要了解更多Python相关知识,请关注IT培训机构:千锋教育。

猜你喜欢LIKE
相关推荐HOT
更多>>
python中open和with open有什么区别?
python中open和withopen有什么区别?本文教程操作环境:windows7系统、Python3.9.1,DELLG3电脑。一、open函数一般是使用open()和close()组合来...详情>>
2023-11-10 23:40:58
python中使用_setattr_()
python中使用_setattr_()本文教程操作环境:windows7系统、Python3.9.1,DELLG3电脑。1、setattr函数给对象的属性赋值,若属性不存在,先创建再...详情>>
2023-11-10 22:45:02
python中如何使用np.delete()方法?
python中如何使用np.delete()方法?在python列表中,如果我们想要删除一个或者连续几个元素,可以使用del()方法,在numpy数组,如果想要删除元素...详情>>
2023-11-10 21:40:05
python中ndarray是什么?
python中ndarray是什么?在使用python的Numpy数组,时,我们总会遇到ndarray,那ndarray是什么呢?ndarray是Numpy中的一个多维数组的数据结构,在...详情>>
2023-11-10 20:08:58热门推荐
python中open和with open有什么区别?
沸python中jsonpath模块有何用法?
热python中使用_setattr_()
热如何使用Python的telnetlib模块?
新python中如何使用np.delete()方法?
python中wordcloud库如何生成词云?
python中ndarray与list转换的方法
python中ndarray是什么?
python套接字的用法
python中如何使用@contextmanage?
Python IDE之Thonny的介绍
python如何安装OpenCV?
python如何实现信息增益和信息增益率
pythonpickle模块的使用注意
技术干货






