Currently within my code for my system i can't seem to get my system to only open up in one window. When i run my code it opens with two screens instead of the main one. I know this is due to the inheritance of my classes just not sure what needs to be changed. (Calendar section and generic skeleton)

Secondly i want a username and password login so they both depend on each other. I have defined each of them but can't get them to both work together so if the username is wrong and password is right it wont go into the protected area ect (mainmenu section)

My code is available here -

I think my inheritance problems lay here:

class GenericSkeleton:

    #constructor creates the window
    def __init__(self):#need to pass in the current object
        self.GenericGui = Tk()#creating a window
        self.GenericGui.title('Housing Management System')
        self.GenericGui.resizable(width = FALSE, height = FALSE)
        #self.Logo = PhotoImage()
        #Label(self.GenericGui,image = self.Logo).place(x=500,y=0)

    #generic destroy function
    def delete(self):


class Data:
    def __init__(self):
        self.day_selected = 0
        self.month_selected = 0
        self.year_selected = 0
        self.day_name = 0

class Calendar(GenericSkeleton):
    def __init__(self,data): = data
        GenericSkeleton.__init__(self) = calendar.TextCalendar(calendar.FRIDAY)
        self.year = 2016
        self.month = 1
        self.wid = []
        self.day_selected = 1
        self.month_selected = self.month
        self.year_selected = self.year
        self.day_name = ''

        self.setup(self.year, self.month)

    def clear(self):
        for w in self.wid[:]:

    def go_prev(self):
        if self.month > 1:
            self.month -= 1
            self.month = 12
            self.year -= 1
        #self.selected = (self.month, self.year)
        self.setup(self.year, self.month)

    def go_next(self):
        if self.month < 12:
            self.month += 1
            self.month = 1
            self.year += 1

        #self.selected = (self.month, self.year)
        self.setup(self.year, self.month)

    def selection(self, day, name):
        self.day_selected = day
        self.month_selected = self.month
        self.year_selected = self.year
        self.day_name = name = day = self.month = self.year = name

        #self.selected = day
        self.setup(self.year, self.month)

    def setup(self, y, m):
        left = tk.Button(self.parent, text='<', command=self.go_prev)
        left.grid(row=0, column=1)

        header = tk.Label(self.parent, height=2, text='{}   {}'.format(calendar.month_abbr[m], str(y)))
        header.grid(row=0, column=2, columnspan=3)

        right = tk.Button(self.parent, text='>', command=self.go_next)
        right.grid(row=0, column=5)

        days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
        for num, name in enumerate(days):
            t = tk.Label(self.parent, text=name[:3])
            t.grid(row=1, column=num)

        for w, week in enumerate(, m), 2):
            for d, day in enumerate(week):
                if day:
                    b = tk.Button(self.parent, width=1, text=day, command=lambda day=day:self.selection(day, calendar.day_name[(day-1) % 7]))
                    b.grid(row=w, column=d)

        sel = tk.Label(self, height=2, text='{} {} {} {}'.format(
            self.day_name, calendar.month_name[self.month_selected], self.day_selected, self.year_selected))
        sel.grid(row=8, column=0, columnspan=7)

        ok = tk.Button(self, width=5, text='OK', command='disabled')
        ok.grid(row=9, column=2, columnspan=3, pady=10)

def win(self,d):
    cal = Calendar(win, d)

data = Data()

Current username/password

#this function is a Username validator
        def EnterUsername():
            UsernameAttempt = Username.get()#how to get value from entry box

        #this function is a password validator
        def EnterPassword():
            Attempt = Password.get()#how to get value from entry box

            if Attempt == 'password' and Attempt == 'username' :
                Secret = SecretMenu()
                PasswordError = messagebox.showerror('Password/Username Entry','Incorrect Username or Password entered.\n         Please try again.')

Would mean a lot if i got some advice, im very much a beginner so anything you guys can help with would be appreciated

It is a lot of code. It seems to me that only the main window should have a Tkinstance as self.GenericGui. Other windows should probably have a Toplevel instance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.