Hi, the following is the code for my a2 computing project. Essentially what I have tried to do is set up two basic structures of GUIS and then inherit them into other classes so I can add components to the basic structure. However, when I create a MainMenu object, only some of the components show up, the frame is not the right size and it is resizable when it shouldn't be. Any ideas? Thanks.

from tkinter import * #Allows GUIs to be created
from random import randint #allows random integers to be generated


class StaffSkeleton: #This class contains the basic layout for the staff parts of the application    
    def __init__(self):
        StaffGui = Tk()
        StaffGui.title('Thomas Hardye Sixth Form Application Program')
        StaffGui.geometry('1024x800+200+200')
        StaffGui.resizable(width = FALSE, height = FALSE)
        #StaffSchoolLogo = PhotoImage(file='N:\Computing\A2 Computing\F454\part 3 Development\crest1-edited.gif')
        #StaffSchoolImage = Label(self,image = StaffSchoolLogo).place(x=854,y=0)

class StudentSkeleton:  #This class contains the basic layout for the student part of the application

    def __init__(self):
        StudentGui = Tk()
        StudentGui.title('Thomas Hardye Sixth Form Application Program')
        StudentGui.geometry('800x640+200+200') #sets the size of the window
        StudentGui.resizable(width = FALSE, height = FALSE) #stops resizing of window
        #StudentSchoolLogo = PhotoImage(file='N:\Computing\A2 Computing\F454\part 3 Development\crest1-edited.gif')#brings in file of school Logo*
        #StudentSchoolImage = Label(self,image = StudentSchoolLogo).place(x=630,y=0)#places school image on screen    



class MainMenu(StudentSkeleton):#inheriting the student skeleton for the main menu GUI
    def __init__(self):
        welcome = Label(text = 'Welcome to the Thomas Hardye Sixth Form Application Program',font=('TkDefaultFont',14)).place(x=80,y=30) #setting up welcome message to users
        welcome2 = Label(text = 'Are you a student or member of staff?',font = ('TkDefaultFont',14)).place(x=200,y=80)
        StudentSelect = Button(text = 'Student',height = 3, width = 15, font = ('TkDefaultFont',14)).place(x=100,y=300) #button to select student side of program
        StaffSelect = Button(text = 'Staff', height = 3, width = 15, font = ('TkDefaultFont',14)).place(x=540,y=300) #button to select staff side of program
        StudentExplain = Label(text = 'This lets you apply \n and use the \n course recommender.',font = ('TkDefaultFont',14)).place(x=90,y=450)
        StaffExplain = Label(text = 'This lets you review applications \n and check subscriptions to courses. \n Please enter the password \n before pressing the button.',font = ('TkDefaultFont',14)).place(x=470,y=450)
        PasswordBox = Entry(show = '*',width = 15,font = ('TkDefaultFont',14)).place(x=544,y=400)




test = MainMenu()

You have to explicitly call the init method in child classes. Also, I am guessing that the widgets are not showing because they are not explicitly placed in the root widget. Finally, there is no reason to assign the return of place() to a variable as it is always "None", and you do not call mainloop() anywhere.

from tkinter import * #Allows GUIs to be created
from random import randint #allows random integers to be generated

class StudentSkeleton:  #This class contains the basic layout for the student part of the application

    def __init__(self):
        ##-----------------------------------------
        ##"self." = visible throughout the class, including parent
        self.StudentGui = Tk()
        ##-----------------------------------------
        self.StudentGui.title('Thomas Hardye Sixth Form Application Program')
        self.StudentGui.geometry('800x640+200+200') #sets the size of the window
        self.StudentGui.resizable(width = FALSE, height = FALSE) #stops resizing of window
        #StudentSchoolLogo = PhotoImage(file='N:\Computing\A2 Computing\F454\part 3 Development\crest1-edited.gif')#brings in file of school Logo*
        #StudentSchoolImage = Label(self,image = StudentSchoolLogo).place(x=630,y=0)#places school image on screen    
        print "__init__ called"


class MainMenu(StudentSkeleton):#inheriting the student skeleton for the main menu GUI
    def __init__(self):
        ##-----------------------------------------
        ## call init method of child class
        StudentSkeleton.__init__(self)
        ##-----------------------------------------
        Label(self.StudentGui, text = 'Welcome to the Thomas Hardye Sixth Form Application Program',font=('TkDefaultFont',14)).place(x=80,y=30) #setting up welcome message to users
        Label(self.StudentGui, text = 'Are you a student or member of staff?',font = ('TkDefaultFont',14)).place(x=200,y=80)
        Button(self.StudentGui, text = 'Student',height = 3, width = 15, 
               font = ('TkDefaultFont',14)).place(x=100,y=300) #button to select student side of program
        Button(self.StudentGui, text = 'Staff', height = 3, width = 15, font = ('TkDefaultFont',14)).place(x=540,y=300) #button to select staff side of program
        Label(self.StudentGui, text = 'This lets you apply \n and use the \n course recommender.',font = ('TkDefaultFont',14)).place(x=90,y=450)
        Label(self.StudentGui, text = 'This lets you review applications \n and check subscriptions to courses. \n Please enter the password \n before pressing the button.',font = ('TkDefaultFont',14)).place(x=470,y=450)
        Entry(self.StudentGui, show = '*',width = 15,font = ('TkDefaultFont',14)).place(x=544,y=400)

        self.StudentGui.mainloop()

test = MainMenu()

Thanks will try this later, you've been a great help!

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.