pythonTkinter(3) 用scale控制label中字体大小

#!/usr/bin/env python
#coding=utf8


from Tkinter import *


def resize(ev = None):
    label.config(font = 'Helvetica -%d bold' % scale.get())


top = Tk()
top.title('label and scale')
top.geometry('250x150')


label = Label(top, text = '你好世界', font = 'Helvetica -12 bold')
label.pack(fill = Y, expand = 1)


scale = Scale(top, from_ = 10, to = 40, orient = HORIZONTAL, command = resize)
scale.set(12)
scale.pack(fill = X, expand = 1)


top.mainloop()

pythonTkinter(3) 用scale控制label中字体大小_第1张图片

pythonTkinter(3) 用scale控制label中字体大小_第2张图片

你可能感兴趣的:(python)