Label text in python/kivy -


i writing code 2 buttons return random text label kivy, can't 2 buttons return texts on same line, want either button overwrite whatever second button displays on same line

: boxlayout:

    orientation: 'vertical'     pos: self.pos     label:         id: label1         text: root.truths     label:         id: label2         text: root.dares      gridlayout:         cols: 2         spaccing: 20         padding: 25         button:             text: 'truth'             on_press: root.truthkey()         button:             text: "dare"             on_press: root.darekey() 

the above code in kv file , code in python file show below

from kivy.app import app kivy.uix.widget import widget kivy.uix.gridlayout import gridlayout kivy.uix.boxlayout import boxlayout import random kivy.properties import stringproperty   class truthanddare(boxlayout):     truths = stringproperty()     dares = stringproperty()      def __init__(self, **kwargs):         super(truthanddare, self).__init__(**kwargs)         self.truths=str(random.choice(['a']))         self.dares=str(random.choice(['b']))      def truthkey(self):         self.truths=str(random.choice(['what biggest fear in relationship',             'what funniest date ever',             'how many kids   have',             'what childhood nickname',             'what favourite movie',             'what favourite food',             'what dream job',             'if trapped on island 3 days, take you',             'do prefer apple or android device',             'what best talent',             'do believe in love @ first sight',             'what dream wedding',             'if change 1 thing on body, be']))      def darekey(self):         self.dares = str(random.choice(['b','c','d','e','f']))    class truthdareapp(app):     def build(self):         return truthanddare()  if __name__=='__main__':     truthdareapp().run() 


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -