返回顶部

收藏

Set font from Root component

更多
from Tkinter import *

class AllTkinterWidgets:
    def __init__(self, master):
        frame = Frame(master, width=500, height=400, bd=1)
        frame.pack()

  self.mbar = Frame(frame, relief = 'raised', bd=2)
  self.mbar.pack(fill = X)

  self.filebutton = Menubutton(self.mbar, text = 'File')
  self.filebutton.pack(side = LEFT)

  self.filemenu = Menu(self.filebutton, tearoff=0)
  self.filebutton['menu'] = self.filemenu

  self.filemenu.add('command', label = 'Exit', command = self.quit)

  self.objectbutton = Menubutton(self.mbar, text = 'Object', )
  self.objectbutton.pack(side = LEFT)

  self.objectmenu = Menu(self.objectbutton, tearoff=0)
  self.objectbutton['menu'] = self.objectmenu

  self.objectmenu.add('command', label = 'object', command = self.stub)

  self.editbutton = Menubutton(self.mbar, text = 'Edit', )
  self.editbutton.pack(side = LEFT)

  self.editmenu = Menu(self.editbutton, tearoff=0)
  self.editbutton['menu'] = self.editmenu

  self.editmenu.add('command', label = 'edit', command = self.stub)

  self.viewbutton = Menubutton(self.mbar, text = 'View', )
  self.viewbutton.pack(side = LEFT)

  self.viewmenu = Menu(self.viewbutton, tearoff=0)
  self.viewbutton['menu'] = self.viewmenu

  self.viewmenu.add('command', label = 'view', command = self.stub)

  self.toolsbutton = Menubutton(self.mbar, text = 'Tools', )
  self.toolsbutton.pack(side = LEFT)

  self.toolsmenu = Menu(self.toolsbutton, tearoff=0)
  self.toolsbutton['menu'] = self.toolsmenu

  self.toolsmenu.add('command', label = 'tools', command = self.stub)

  self.helpbutton = Menubutton(self.mbar, text = 'Help', )
  self.helpbutton.pack(side = RIGHT)

  self.helpmenu = Menu(self.helpbutton, tearoff=0)
  self.helpbutton['menu'] = self.helpmenu

  self.helpmenu.add('command', label = 'help', command = self.stub)

    def quit(self):
        root.destroy()

    def stub(self):
        pass

root = Tk()
root.option_add('*font', ('verdana', 10, 'bold'))
all = AllTkinterWidgets(root)
root.title('Tkinter Widgets')
root.mainloop()

标签:Python,2D

收藏

0人收藏

支持

0

反对

0

»更多 您可能感兴趣的代码
  1. 2016-11-14 10:27:46Radiobuttons demonstration set Font in Text by 张宋付
  2. 2016-04-23 09:05:45Checkbutton to set font to bold by 风云轩
  3. 2016-12-31 09:02:56Checkbuttons demonstration: set font by 蟋蟀MM
  4. 2015-12-03 09:40:19Button font: underline italic by 山药
  5. 2016-04-23 09:24:00Draw lines by 蟋蟀MM
  6. 2017-04-01 16:33:01Draw Arc by 阿明娃儿
  7. 2013-06-05 13:21:25python 使用MySQLdb连接mysql by 玉开Sir
  8. 2016-04-23 09:45:22Line width by jack.chen
  9. 2016-02-25 16:20:21Line with pattern by wubai
  10. 2016-09-24 09:03:03Warning bmp on a Label by jack.chen
  11. 2016-11-05 21:19:18Line color by 山药
相关聚客文章
  1. 博主 发表 2012-12-08 00:00:00 Python学习
  2. 博主 发表 2018-05-29 13:54:25 Python 实现的 HTTP 报文头回声服务
  3. 博主 发表 2013-04-03 00:00:00 windows下安装python虚拟机环境virtualenv
  4. techug 发表 2018-06-06 02:07:47 python有趣用法汇总
  5. coder4 发表 2015-01-12 12:38:29 Python中使用pack/unpack编码字节数据
  6. admin 发表 2018-06-21 02:30:19 Nginx模块在Python开发中的应用
  7. 博主 发表 2015-01-16 06:10:23 Python源码剖析读书笔记(二)
  8. fox64194167 发表 2018-07-06 01:04:13 python virtualenv 包虚拟环境
  9. 疯狂小强 发表 2014-02-24 07:44:31 Linux下安装Nodejs
  10. 博主 发表 2016-03-08 00:00:00 Python 性能分析工具 cProfile
  11. 代码猴 发表 2015-01-26 08:54:00 python random.py 接口分析
  12. 仙宇 发表 2018-07-14 08:19:49 【Python搞搞轻量博客】第五发 关系型数据库Mysql的Py交易