I cannot make the checkbox to give a "1" value when its marked and the button is clicked. I don't know if the problem is within the checkbutton code or I am transferring the data between functions wrong
import tkinter as tk
from tkinter import ttk as ttk
var_koszula1=2
class Aplikacja(tk.Frame):
def __init__(self, *args, **kwargs):
tk.Frame.__init__(self, *args, **kwargs)
self.grid()
self.var_koszula1=tk.IntVar(self)
tk.Checkbutton(self, text='MARK', variable=var_koszula1).grid()
print(self.var_koszula1.get())
tk.Button(self, height=1, width=15, text=("Click"), command= self.create_window_edit).grid()
def create_window_edit(self):
t = tk.Toplevel(self)
tk.Label(t, text=("Done")).grid()
print(self.var_koszula1.get())
root= tk.Tk()
root.title("Szaffa")
app= Aplikacja(root)
root.mainloop()
Aucun commentaire:
Enregistrer un commentaire