Python Forum
[Tkinter] GUI Speed
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] GUI Speed
#3
I sure can:

import random
from tkinter import *
import time

# GUI
root = Tk()
root.geometry('900x900+250+100')
root.title('Test')
root.configure(background='grey')
Kanvas = Canvas(root,width=900, height=900, bg='grey')
Kanvas.pack()    

colors = ('white','yellow','green','red')
def new_sit():
    for row in range(60):
        for col in range(60):
            color= random.choice(colors)
            y = row * 15 
            x = col * 15
            Kanvas.create_rectangle(x,y,x+15,y+15,fill=color)
    root.update()
    
steps = 0
while True:
    steps += 1
    Kanvas.delete('all')
    print(f'Step {steps}')
    new_sit() 
   
root.mainloop()
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply


Messages In This Thread
GUI Speed - by DPaul - Jul-20-2020, 07:49 AM
RE: GUI Speed - by deanhystad - Jul-20-2020, 01:59 PM
RE: GUI Speed - by DPaul - Jul-20-2020, 02:50 PM
RE: GUI Speed - by deanhystad - Jul-20-2020, 06:25 PM
RE: GUI Speed - by DPaul - Jul-21-2020, 06:38 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020