rippon
rippon

Reputation: 31

Buttons don't appear

Why are my Buttons not appearing?

from tkinter import *
from tkinter import ttk

window = Tk()
window.title("window title")
frame = ttk.Frame(window)

btnTest = Button(frame, text = 'test').grid(row = 0, column = 0)
btnExit = Button(frame, text = 'exit', command = exit).grid(row = 0, column = 1)

window.mainloop()

Upvotes: 0

Views: 37

Answers (1)

joao
joao

Reputation: 2293

You created the buttons inside a frame, and you're placing them with the grid() geometry manager, that's fine. But you haven't placed the frame itself, try this:

frame = ttk.Frame(window)
frame.grid()

Actually, the frame is the widget that's not appearing.

Upvotes: 3

Related Questions