tubeshowcase●1,194,391 videos♡ My collection 0
← Learn to Code

Learn to Code12:49

Learn Python tkinter GUI checkboxes easy ✔️

Bro Code ↗

From the creator

You guys don't need all the config() calls, you can place them within the constructor if you want. I like to add comments line-by-line for teaching purposes to help explain. Do what works for you. Python GUI tkinter checkbutton/checkbox tutorial for beginners #Python #GUI #tkinter #checkbutton #checkbox #tutorial #beginners from tkinter import * def display(): if(x.get()==1)&(y.get()==0): print("I like Python") elif(x.get()==0)&(y.get()==1): print("I like Java") elif(x.get()==1)&(y.get()==1): print("I like both Python & Java") else: print("I don't like either") window = Tk() x = IntVar() y = IntVar() checkbox = Checkbutton(window,text='Python',variable=x,onvalue=1,offvalue=0,command=display) checkbox.pack() checkbox.config(font=('Arial',20)) #changes the font checkbox.config(fg='#00FF00') #foreground color checkbox.config(bg='#000000') #background color checkbox.config(activeforeground='#0000FF') #active foreground color checkbox.config(activebackground='#000000') #active background color photo = PhotoImage(file='python_logo.png') checkbox.config(image=photo,compound='left') #sets image to photoimage checkbox.config(padx=25,pady=10,width=250,height=50) checkbox.config(anchor='w') #anchors widget to relative cardinal direction checkbox2 = Checkbutton(window,text='Java',variable=y,onvalue=1,offvalue=0,command=display) #checkbox2.pack() checkbox2.config(font=('Arial',20)) #changes the font checkbox2.config(fg='#0000FF') #fore

Published 2020-08-04 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code