Python – GUI (Grid Layout)

In this tutorial, I will be demonstrating Graphical User Interface
Programming using Python.

The codes are below:

 

gui2

 

 

Our output should be the same as below:

 

gui1

 

 

Explanation:

 

These lines:

Label(master, text=”Name:”).grid(row=0)
Label(master, text=”Age:”).grid(row=1)

– one way of declaring one or more labels and giving them their position in the grid

While these lines:

E1 = Entry(master)
E2 = Entry(master)

E1.grid(row=0, column=1)
E2.grid(row=1, column=1)

-another way of declaring one or more textboxes then giving their position in separate lines.

 

Thank you for reading this post.

Don’t forget to leave a comment or suggestion. 🙂

Python – GUI (Label and Textbox)

In this tutorial, I will be demonstrating Graphical User Interface
Programming using Python.

The codes are below:

gui1

 

Our output should be the same as below:

gui2

 

 

Explanation:

 

The lines:

top = Tk()

top.mainloop()

– are used to initialize the form

 

The lines:

L1 = Label(top, text=”First Name”)

L1.pack( side = LEFT)

-used to initialize and position the Label to the left with a caption of First Name

 

The lines:

E1 = Entry(top, bd =5)

E1.pack(side = RIGHT)

-used to initialize and position the text box to the right.

 

Thank you very much for reading this post.

Don’t forget to leave a comment or suggestion. 🙂