Reputation: 11
I want to make my red text slowly turn to green (and later to blue). Of course I was traying to make it by myself. Here's the code where I was traying for start turn slowly color from black to red:
from guizero import App, Text
from time import sleep
done = 0
re = 0
ge = 0
be = 0
app = App("My title")
a = Text(app, text="Hello World", color = "black")
while done == 0:
a.text_color = (re, ge, be)
re = re + 1
if re == 256:
done = 1
sleep(0.1)
app.display()
Then when I'm turning on the code I see no error and app, IS on the screen, but it can't show any text and it's crushing (after some time I see "(not responding)" on the top of the app... and that's it!). I'm always see no error.
If it can help I'm working on mu.
I was traying:
I can't fix it! Can someone help?
Please!
There is more data. By your commants I did new code where I started to do it fully (to first turn from red to green, later to blue and to again red) (there's again the same not responding problem):
from guizero import App, Text,PushButton
from time import sleep
re = 255
ge = 0
be = 0
don = 0
work = 1
def strt():
global don, re, ge, be, work
start.hide()
seco.show()
for x in range(2):
don = 0
while don == 0:
if work == 1:
if not re == 0:
re = re - 1
ge = ge + 1
else:
work = 2
elif work == 2:
if not ge == 0:
ge = ge - 1
be = be + 1
else:
work = 3
elif work == 3:
if not be == 0:
be = be - 1
re = re + 1
else:
work = 1
don = 1
seco.text_color = (re, ge, be)
sleep(0.1)
app = App("Top Secret (yet)")
app.bg = "black"
fill = Text(app, "", 200)
start = PushButton(app, strt, text="Start!")
start.bg = "blue"
seco = Text(app, "nothing", 50, color = (re,ge,be), font = "Algerian")
seco.hide()
app.display()
Upvotes: 0
Views: 69