


If you forget and place the button on the same column which is 0, it will show the button only, since the button will be on the top of the label. Note that we place the button on the second column of the window which is 1. So our window will be like this: from tkinter import * Let’s start by adding the button to the window, the button is created and added to the window the same as the label: btn = Button(window, text="Click Me") Let’s try adding more GUI widgets like buttons and see how to handle the button click event. The above line sets the window width to 350 pixels and the height to 200 pixels. We can set the default window size using geometry function like this: window.geometry('350x200') Great, but the window is so small, we can even see the title, what about setting the window size? Setting window size Note that the font parameter can be passed to any widget to change its font not labels only. To do so, you can pass the font parameter like this: lbl = Label(window, text="Hello", font=("Arial Bold", 50)) You can set the label font so you can make it bigger and maybe bold. Without calling the grid function for the label, it won’t show up. So the complete code will be like this: from tkinter import * Then we will set its position on the form using the grid function and give it the location like this: lbl.grid(column=0, row=0) To add a label to our previous example, we will create a label using the label class like this: lbl = Label(window, text="Hello") If you forget to call the mainloop function, nothing will appear to the user. The last line which calls the mainloop function, this function calls the endless loop of the window, so the window will wait for any user interaction till we close it.
