The script is intended to create a window with a navy background and 200 yellow stars, but the window remains empty, and even the background color does not change. But on my friends laptop (he has Windows 11).
This code works:
import tkinter
import random
n = 200
width = 800
height = 600
root = tkinter.Tk()
root.title("Hviezdne nebo")
canvas = tkinter.Canvas(root, width=width, height=height, bg='navy')
canvas.pack()
for _ in range(n):
x = random.randint(0, width)
y = random.randint(0, height)
font_size = random.randint(10, 20)
canvas.create_text(x, y, text='*', fill='yellow', font=('Helvetica', font_size))
root.mainloop()
I've tried to reinstall both Python and Tkinter - didn't help.
Tried this on Windows 11 - it did help
edit: running the file in zsh terminal instead of vscode defaults (for python at least) solved the issue