import tkinter as tk
import random

# Vytvoreni hlavniho okna a platna
root = tk.Tk()
root.title("Stitek")
canvas = tk.Canvas(root, width=200, height=200, bg='white')
canvas.pack()

# Velikost stitku
width, height = 50, 20

def stitek():
    # Nahodne souradnice stredu stitku
    x = random.randint(width//2, 200 - width//2)
    y = random.randint(height//2, 200 - height//2)
    
    # Vykresleni stitku
    canvas.create_rectangle(x - width//2, y - height//2, x + width//2, y + height//2, fill='white', outline='black')
    
    # Vlozeni textu do stredu stitku
    canvas.create_text(x, y, text="Martin", fill="black")

# Zavolani podprogramu stitek desetkrat
for _ in range(10):
    stitek()

# Spusteni hlavni smycky
root.mainloop()