How to display text or Popup in kivy while python sript is running
Hi everyone reading this topic.
That what i trying to do is: automaticly display text in Label after value is match in if statment. Second option could be Popup insted Label. Third way could be jump to different screen.
Please help me, i don't really know how can i connect this with kivy without using any buttons. Here are codes:
python:
from kivy.app import App
import random
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
class Main(ScreenManager):
pass
class Numbers(Screen):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def process(self):
num_list = ['four','three']
number = random.choice(num_list)
self.number.text = number
print(number)
while True:
if number == 'null':
pass
elif number == 'three':
pass
elif number == 'four':
self.root.ids.numb.text="four"
print(' for example Here i need connect code with kivy to display on screen text as string or jump to another screen')
break
else:
pass
kv = Builder.load_file('temp.kv')
class NumbersApp(App):
def build(self):
return kv
if __name__ == '__main__':
NumbersApp().run()
and kv file:
Main:
Numbers:
<Numbers>:
number:numb
cols:1
RelativeLayout:
Label:
id: numb
text: 'Text display after getting \ninfo from script in while loop \nin process def'
font_size: '15'
hint_size: None, None
pos_hint: {'x': 0.04, 'y': -0.4}
color: 1,1,1,1
from Recent Questions - Stack Overflow https://ift.tt/3xsScMI
https://ift.tt/eA8V8J
Comments
Post a Comment