I'm having issues with my constructor. I get the error __init__() missing 1 required positional argument: 'checkbutton'
Update:
this is my main file:
from GUI_Rootmodule import GUI_Root
gui_root = GUI_Root()
this is my rootmodule file:
from GUI_Unitmodule import Unit
from tkinter import *
class GUI_Root:
def __init__(self):
print("hoi")
window = Tk()
window.title("Project: Embedded Systems")
rootframe = Frame(window, width=1800, height=750)
rootframe.pack()
Unit(rootframe)
window.mainloop()
this is my Unitmodule:
from tkinter import *
class Unit:
def __init__(self, master, checkbutton):
self.frame1 = Frame(master) #Frame voor labels, buttons, entries
self.frame1.pack()
# Checkbutton #
print("test frame")
self.var1 = IntVar()
self.checkbutton = checkbutton(self.frame1, text="Automatisch", variable=self.var1, onvalue= 1, offvalue= 0, pady=20).grid(row=0, column=0, sticky=E)
print("test checkbutton")
# Labels #
self.Extend_Label = Label(self.frame1, text="Uitrol afstand", pady=20).grid(row=2, column=0, sticky=E)
self.Retract_Label = Label(self.frame1, text="Inrol afstand", pady=20).grid(row=3, column=0, sticky=E)
self.Temperture_Label = Label(self.frame1, text="Temperatuur Trigger", pady=20).grid(row=4, column=0, sticky=E)
self.LightIntensity_Label = Label(self.frame1, text="Lichtintensiteit Trigger", pady=20).grid(row=5, column=0, sticky=E)
print("test label")
# Entry #
self.Extend_Entry = Entry(self.frame1).grid(row=2, column=1, sticky=E)
self.Retract_Entry = Entry(self.frame1).grid(row=3, column=1, sticky=E)
self.Temperture_Entry = Entry(self.frame1).grid(row=4, column=1, sticky=E)
self.LightIntensity_Entry = Entry(self.frame1).grid(row=5, column=1, sticky=E)
print("test entry")
# Buttons
self.A = Button(self.frame1, text ="Inrollen", padx=10, pady=20).grid(row=6, column=0)
self.B = Button(self.frame1, text ="Uitrollen", padx=10, pady=20).grid(row=6, column=1)
print("test button")
I've tried to run in it, but it keeps saying that I'm missing an argument which i've put in init(self, master, checkbutton)
Can someone explain what I'm missing here and/or doing wrong ?
Update 2: Without the checkbutton code, the rest works and shows a simple GUI. It's still not clear where exactly i'm missing the argument for checkbutton