Last active
May 2, 2018 14:05
-
-
Save haraonline/b6da4a25ceb1cfd84a78c0033f94d1d6 to your computer and use it in GitHub Desktop.
tkinter slider that changes font size dynamically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
from tkinter import ttk | |
master = Tk() | |
master.geometry('750x350+200+200') | |
scale_1 = ttk.Scale(master, orient='horizontal', length=200, from_=10, to=30) | |
scale_1.pack(padx=10, pady=30, anchor='nw') | |
label_1 = ttk.Label(master, text='Hello World', background='orange', font=('Candara', 10, 'italic')) | |
label_1.pack(padx=10, pady=10, fill='both', expand=True) | |
def fontSize(): | |
label_1.config(font=('Candara', int(scale_1.get()))) | |
scale_1.config(command=lambda e: fontSize()) | |
master.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment