I'm trying to create a tkinter (python 3) application on raspbian, but won't repeat drawing -


my code below; should draw random colour , size circles repeatedly, draws one. have tried countless combinations of mainloop() , window1.update() have same problem.

#!/usr/bin/env python3 tkinter import * random import * width = 1024/2 height = 720/2 window1 = tk() c1 = canvas(window1, width=width, height=height, bg='#ffffff') c1.pack() colours = ('#ff0000', '#00ff00', '#0000ff', '#ffff00', '#ff00ff') while 3 == 3:     colchose = choice(colours)     x0 = randint(0, width)     y0 = randint(0, height)     c1.create_oval(x0, y0, x0+d, y0+d, fill=colchose)     mainloop() 

the problem mainloop() call in last line. call end, once whole program has terminated.
suggest @ threading facilities of python. create thread draws onto canvas while mainloop executing.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -