Sunday, February 7, 2021

Checkbutton Widget

 check.py


#!/usr/bin/env python3


from tkinter import *


root =Tk()

root.geometry("400x400")


def show():

    my_label = Label(root, text=var.get()).pack()


var = StringVar()


c=Checkbutton(root, text="Here", variable=var, onvalue = "On", offvalue = "Off", command=show)

c.deselect()

c.pack()


my_button = Button(root, text="show", command=show).pack()


root.mainloop()


No comments:

Post a Comment