Rotate your phone or change to desktop for better experience

Rotate your phone or change to desktop for better experience

6. Create a GUI using Tkinter module

 from tkinter import *

top = Tk()

top.geometry("200x200")

c = Canvas(top, bg="pink", height="200", width=200)

line = c.create_line(10, 10, 50, 50, fill="red")

oval = c.create_oval(100, 100, 150, 10, fill="white")

rect = c.create_rectangle(10, 80, 40, 50, fill="white")

txtfld=Entry(top, text="This is Entry Widget", bd=5)

txtfld.place(x=80, y=150)

btn=Button(top, text="This is Button widget", fg='blue')

btn.place(x=80, y=100)

c.pack()

top.mainloop()

Post a Comment

0 Comments