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

API

The document contains Python code that uses the Tkinter library to create graphical elements such as rectangles, lines, and ovals on a canvas. It generates random values to display text within the shapes, including calculations based on these random values. The code is structured in multiple sections, each creating different visual patterns and elements on the canvas.

Uploaded by

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

API

The document contains Python code that uses the Tkinter library to create graphical elements such as rectangles, lines, and ovals on a canvas. It generates random values to display text within the shapes, including calculations based on these random values. The code is structured in multiple sections, each creating different visual patterns and elements on the canvas.

Uploaded by

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

import tkinter

import random
canvas=[Link](width=600)
[Link]()

x=100
y=100
for i in range(1,4):
canvas.create_rectangle(x,y,x+60,y+100, fill='skyblue')
canvas.create_rectangle(x+10,y-50,x+50,y, fill='skyblue')
canvas.create_rectangle(x+15,y-40,x+25,y-30, fill='yellow')
canvas.create_rectangle(x+35,y-40,x+45,y-30, fill='yellow')
canvas.create_rectangle(x+15,y-20,x+45,y-10, fill='red')
canvas.create_rectangle(x,y+100,x+20,y+180, fill='skyblue')
canvas.create_rectangle(x+40,y+100,x+60,y+180, fill='skyblue')
canvas.create_line(x,y+10,x-40,y+50, width=18)
canvas.create_line(x+60,y+10,x+110,y+50, width=18)
x+=158
import tkinter
canvas=[Link](width=580, height=280)
[Link]()

x=10
y=10

posun=50
for i in range(5):
canvas.create_line(x,y,x+posun,y)
canvas.create_line(x+posun,y,x+posun,y+posun)
x+=50
y+=50
w=500
z=60
for j in range(5):
canvas.create_line(w,z,w,z-posun)
canvas.create_line(w,z-posun,w+posun,z-posun)
w-=50
z+=50
import random
import tkinter
canvas=[Link](width=588)
[Link]()

a=[Link](8,88)
w=[Link](1,10)
x=[Link](10,15)
y=[Link](10,15)
z=[Link](1,10)
if x==z: import random import tkinter
z=[Link]([20,40,50,60,70,80]) canvas=[Link](width=488)
canvas.create_oval(a,a,a+88,a+88, fill='white', outline='red', width=8) [Link]()
canvas.create_text(a+42,a+44, text=x*10, font='Freestyle 33
a=[Link](8,88)
italic',fill='black')
w=[Link]([100,110,120,150])
canvas.create_oval(a+104,a,a+192,a+88, fill='white', outline='red',
width=8) x=[Link]([20,30,40,50,60,70,80])
canvas.create_text(a+146,a+44, text=z*10, font='Freestyle 42 y=[Link]([100,110,120,150])
italic',fill='black') z=[Link]([20,30,40,50,60,70,80])
canvas.create_oval(a+208,a,a+296,a+88, fill='white', outline='red', if x==z:
width=8) z=[Link]([20,40,50,60,70,80])
canvas.create_text(a+248,a+44, text=y*10, font='Freestyle 33 canvas.create_oval(a,a,a+88,a+88, fill='white', outline='red',
italic',fill='black') width=8)
canvas.create_oval(a+308,a,a+396,a+88, fill='white', outline='red', canvas.create_text(a+42,a+44, text=x, font='Freestyle 42
width=8) italic',fill='black')
canvas.create_text(a+348,a+44, text=w*10, font='Freestyle 42 canvas.create_oval(a+104,a,a+192,a+88, fill='white', outline='red',
italic',fill='black') width=8)
canvas.create_text(a+146,a+44, text=z, font='Freestyle 42
italic',fill='black')
canvas.create_oval(a+208,a,a+296,a+88, fill='white', outline='red',
width=8)
canvas.create_text(a+248,a+44, text=y, font='Freestyle 33
italic',fill='black')
canvas.create_oval(a+308,a,a+396,a+88, fill='white', outline='red',
width=8)
canvas.create_text(a+348,a+44, text=w, font='Freestyle 33
italic',fill='black')

You might also like