TheUnknown
TheUnknown

Reputation: 33

Tk window not showing anything

I am making a game in python 3.4.2 with the tkinter module, yet for some reason the Tk window comes up yet none of my buttons or labels show up. Any ideas?
This is my code.

 root = Tk()
 frameone = Frame(root, width = 400, height = 400)

 lone = Label(frameone, text = 'NumberGuessingGame. Author: ************. Version: 6.0', fg = 'red')
 lone.grid(row = 0)

 ltwo = Label(frameone, text = 'This is a game in which you select your difficulty.', fg = 'red')
 ltwo.grid(row = 1)

 lthree = Label(frameone, text = 'Then the computer generates a number which you have to guess.', fg = 'red')
 lthree.grid(row = 2)

 lfour = Label(frameone, text = 'The computer then gives you a score', fg = 'red')
 lfour.grid(row = 3)

 buttonone = Button(frameone, text = 'Continue')
 buttonone.grid(row = 0, column = 1)

 root.mainloop()  

I do have code after this just incase that matters.

Upvotes: 1

Views: 197

Answers (1)

falsetru
falsetru

Reputation: 369424

If the containing widget is not laid out, children widgets are not shown.

pack, grid or place the frame widget:

root = Tk()
frameone = Frame(root, width=400, height=400)
frameone.grid(row=0, column=0)  # <----
...

Upvotes: 3

Related Questions