Create a program called najvacsi_obdlznik.py, that draws the largest possible rectangle so that its sides are visible (choose the coordinates by trial and error). Can we set the size of the canvas? If so, find out how.
Create a new program called ramcek.py, in which you draw a frame like this using four narrow rectangles:
Create a new program called 5_miesto_3.py, in which you modify the following code so that it draws the same image, but the program contains only 3 commands for drawing rectangles:
canvas.create_rectangle(90, 90, 150, 150, fill='yellow')
canvas.create_rectangle(150, 90, 210, 150, fill='red')
canvas.create_rectangle(90, 150, 150, 210, fill='green')
canvas.create_rectangle(30, 90, 90, 150, fill='red')
canvas.create_rectangle(90, 30, 150, 90, fill='green')
Create a new program called pozicia_premennej.py and copy the following code into it.
The variables x and y contain the coordinates of the top-left corner of the square. Complete the program so that, using the given variables, it draws a square with a side length of 100:
import tkinter
canvas = tkinter.Canvas()
canvas.pack()
x = 100
y = 70
canvas.create_rectangle(x, y, x + , , fill='yellow')
For example, when the program contains:
x = 100
y = 70
sirka = 200
vyska = 50
it should draw a rectangle like the one shown in the image.
These squares have a common top-left corner, whose coordinates are x, y. The squares gradually become smaller: the red one has a side length of 100, the blue one 70, and the dark blue one 40. Use a for loop when drawing them.
The coordinates of the top-left corner of the first rectangle are stored in the variables x, y. All three rectangles have the same width and height, and these values are stored in the variables a, b.
Will the program work correctly if you increase the value of variable a by 20 and the value of variable y by 10? If not, fix the program.
In a new program called stred_stvorca.py, write code that draws a green square with its center at [x, y] and a side length of 100.
Will the program work correctly if you increase the value of variable x by 17 and the value of variable y by 29? If not, fix the program.