0% found this document useful (0 votes)
23 views2 pages

Python GUI for Drawing Shapes

This document contains a Python script that uses Tkinter and Turtle graphics to create a GUI for drawing geometric shapes. Users can input dimensions for a rectangle and a parallelogram, as well as an angle for the parallelogram, and then draw the shapes by clicking buttons. The interface includes labeled entry fields and buttons for user interaction.

Uploaded by

Ella
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views2 pages

Python GUI for Drawing Shapes

This document contains a Python script that uses Tkinter and Turtle graphics to create a GUI for drawing geometric shapes. Users can input dimensions for a rectangle and a parallelogram, as well as an angle for the parallelogram, and then draw the shapes by clicking buttons. The interface includes labeled entry fields and buttons for user interaction.

Uploaded by

Ella
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import tkinter as tk

from tkinter import *


import turtle

t = [Link]()
root = [Link]()
root.wm_title("PROJEKTNI ZADATAK - XXX")
canvas = [Link](root, width=600, height=600, bg="yellow")
[Link]()

stranica1_entry = Entry(root, width=6, bg="grey")


stranica1_entry.place(x=120, y=60)
stranica2_entry = Entry(root, width=6, bg="grey")
stranica2_entry.place(x=120, y=90)
kut_entry = Entry(root, width=6, bg="grey")
kut_entry.place(x=120, y=120)

text = Label(root, text="Nacrtajmo likove", font=(


"Helvetica", 14), bg="red", fg="white")
[Link](x=20, y=20)
text = Label(root, text="Unesi stranicu a:")
[Link](x=20, y=60)
text = Label(root, text="Unesi stranicu b:")
[Link](x=20, y=90)
text = Label(root, text="Unesi kut:")
[Link](x=20, y=120)

def rectangle():
[Link]()

str1 = int(stranica1_entry.get())
str2 = int(stranica2_entry.get())

[Link]()

[Link]("blue", "blue")
t.begin_fill()

[Link](str1)
[Link](90)
[Link](str2)
[Link](90)
[Link](str1)
[Link](90)
[Link](str2)

t.end_fill()

def paralelogram():
[Link]()
str1 = int(stranica1_entry.get())
str2 = int(stranica2_entry.get())
kut = int(kut_entry.get())
[Link]()

[Link]("red", "red")
t.begin_fill()
[Link](kut)
[Link](str2)
[Link](kut)
[Link](str1)
[Link](180-kut)
[Link](str2)
[Link](kut)
[Link](str1)
t.end_fill()

rectangler = Button(root, text="PRAVOKUTNIK",


command=rectangle, bg="blue", fg="white")
paralelogramer = Button(root, text="PARALELOGRAM",
command=paralelogram, bg="green", fg="white")
[Link](x=20, y=200)
[Link](x=20, y=250)

[Link]()

You might also like