返回顶部

收藏

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-02-25 16:20:21Line with pattern by wubai
  2. 2016-09-24 09:03:03Warning bmp on a Label by jack.chen
  3. 2016-11-05 21:19:18Line color by 山药
  4. 2016-01-21 16:07:51Draw circle by 张宋付
  5. 2017-03-05 13:53:41Draw Math Curve by jack.chen
  6. 2015-12-07 19:24:39Load bitmap into a Canvas by 山药
  7. 2016-01-29 16:07:13Label font by 阮小七
  8. 2016-11-08 09:02:07Draw Rectangle by 阮小七
  9. 2017-03-05 14:15:26Set Button style: font by 风云轩
  10. 2016-10-29 09:05:11Draw rectangle with filled color by jack.chen
  11. 2019-06-17 21:18:10PHP+jQuery.photoClip.js图片裁剪上传实例 by 素材火官网

发表评论