zoukankan      html  css  js  c++  java
  • Label Button Scale控件

    脚本的功能包括一个resize的回调函数 该函数会议赋予Scale控件。当Scale控件的滑块移动时,这个函数就会被激活,用来调整label控件中文字的大小

    # coding=utf-8
    import tkinter as tk
    
    def resize(ev=None):
        label.config(font='Helvetica -%d bold' % scale.get())
    top = tk.Tk()
    top.geometry('250x150')        #定义顶层窗口大小
    
    label = tk.Label(top, text='Hello World', font='Helvetica -12 bold')
    
    label.pack(fill=tk.Y, expand=1)
    
    scale = tk.Scale(top, from_=10, to=40, orient=tk.HORIZONTAL, command=resize)
    scale.set(12)
    scale.pack(fill=tk.X,expand=1)
    
    quit = tk.Button(top, text='QUIT', command=top.quit, activeforeground='white', activebackground='red')
    quit.pack()
    
    tk.mainloop()

     如图所示 当滑块移动时,lael中文字的大小发生变化

  • 相关阅读:
    day02
    Hive_分区排序(Distribute By)
    flink添加水位线
    SparkSQL读写JDBC
    spark累加器及UDTF
    datax同步json中文乱码问题
    mysql踩过的坑
    spark算子
    spark分区计算方式
    git操作
  • 原文地址:https://www.cnblogs.com/francischeng/p/9549226.html
Copyright © 2011-2022 走看看