Python Spinbox Change Fontsize GUI Program

By | March 24, 2020

Topic: Python Spinbox Change Fontsize – Chnage Font Size Spinbox GUI Program Example

This Python GUI program using tkinter GUI package, shows the use of Spinbox widget. As the proggram is in execution state, its GUI main window will wait for user input. If the user will change the spinbox value by increasing or decreasing, the font size of label control’s text will also change accordingly.

The value in Spinbox widget is directly linked to font size. If the value in spinbox widget is 20, then fontsize of label widget will also be 20 and so on.

Python 3 tkinter Spinbox GUI Program Example

Python 3 tkinter Spinbox GUI Program Example


# Python 3 GUI program
# using Spinbox and Label
# widgets to increase font size
# of label by Spinbox change

from tkinter import*

def main():
    main_window = Tk()
    main_window.resizable(0, 0) 

    main_window.title('tkinter SpinBox Example')

    label1 = Label(main_window, text="Spin Box Example")

    label1.config(bg='green', fg='white', font=('verdana', 10))                  

   , y=50)

    def change_fontsize():
        font_size = int(spinbox1.get())
    label2 = Label(text="Increase / Decrease Font Size with Spinbox"),y=225)
    spinbox1 = Spinbox(main_window, from_=10, to=20,

    label2 = Label(text="",


How this Python GUI program works?

Python Spinbox Change Fontsize GUI Program

  • Import * from tkinter GUI module.
  • Define main function
  • Create main window
  • Make main window not resizable
  • Set ttle of the main window
  • Create a label1, set font color, background color etc.
    Place label 1 in main window
  • Define a function to change font size
  • Get value of font size from spinbox when the user changes value of spinbox
  • Create a label2, set font properties
    Place label2 in main window
    Call the mainloop() to display the GUI and start the program.

You will also like:


One thought on “Python Spinbox Change Fontsize GUI Program

  1. Pingback: Python GUI Multiplication Table |

Leave a Reply

Your email address will not be published. Required fields are marked *