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

来源:互联网 发布:java注册界面代码 编辑:程序博客网 时间:2024/05/22 06:27
#!/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()


0 0
原创粉丝点击