Skip to content

Instantly share code, notes, and snippets.

@FONQRI
Created August 24, 2020 12:41
Show Gist options
  • Save FONQRI/b3aa84073635b8cef80b11799e80b638 to your computer and use it in GitHub Desktop.
Save FONQRI/b3aa84073635b8cef80b11799e80b638 to your computer and use it in GitHub Desktop.
from tkinter import *
from tkinter import ttk
root=Tk()
checkbutton=ttk.Checkbutton(root,text='spam ?')
checkbutton.pack()
spam=StringVar()
spam.set('SPAM!')
checkbutton.config(variable = spam,onvalue =' spam hast',offvalue=' spam nist')
breakfast = StringVar()
breakfast.set('siram')
def button_callback():
print(spam.get())
print(breakfast.get())
button=ttk.Button(root,text='print spam ',command=button_callback)
button.pack()
abgosht = ttk.Radiobutton(root,text = 'abgosht',
variable= breakfast,value= 'abgosht').pack()
mast = ttk.Radiobutton(root,text = 'mast',
variable= breakfast,value= 'mast').pack()
halim = ttk.Radiobutton(root,text = 'halim',
variable= breakfast,value= 'halim').pack()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment