0

Hi I want to know how the code works in python for the below

Def func1(self):
    self.components.mytextbox.text = 'Yes'
    while 1:
        time.sleep(100)
        self.components.mytextbox.text = 'No'
        if self.components.mytextbox.text=='No':
            break
Def func2(self):
    self.func1()` 

According to me, first mytextbox's text is 'Yes'. After 100 seconds, it should be 'No'. But for me, when I call the function, the mytextbox text is not updating with 'Yes'. It is always showing 'No'. What could be the reason?

Kevin
  • 74,910
  • 12
  • 133
  • 166
PSSR
  • 471
  • 1
  • 10
  • 18
  • Proper code formatting would make this a lot easier to read and potentially answer, especially given that Python whitespace is important... – James Elderfield Sep 04 '13 at 11:08
  • The while loop is unnecessary, just calling sleep and then setting the text should have the same effect. I can't see anything immediately wrong with this code, can you post the code for mytextbox as well? – James Elderfield Sep 04 '13 at 11:15
  • Actually i want to know how it works will that mytextbox is Yes before sleep if yes it is not working for me even i removed while also – PSSR Sep 04 '13 at 11:43
  • _"I want to know how the code works in python"_. It doesn't work, because `Def` with a capital D is a syntax error. Please post your actual code. Posting code that _looks_ like your actual code isn't helpful, since you may be introducing new problems, or even omitting the original problem. – Kevin Sep 04 '13 at 12:01

0 Answers0