omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    TextView help needed

    Pythonista
    2
    3
    1527
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Baconinvader
      Baconinvader last edited by

      I'm trying to create a pythonista version of the card game cheat and I have decided to use a TextView for the first time (I'm a bit of a noob).
      The problem is that I can't figure out how to edit the text. I tried Log(name of my TextView).text = 'Some text' and it didn't give me any errors but It wouldn't work. I'm probably just missing out some really stupidly obvious thing but any help would be nice 😄.

      Code so far (very early stages, basically just tests and badly written button code):
      import ui
      import time
      player = 1
      amountofplayers = 4
      saidlastcard = 3
      lastcard = 2
      cheating = False
      playing = False
      playing = True
      def button_tapped(sender):
      if(sender.name == 'Cheat'):
      if(lastcard == saidlastcard):
      cheating = False
      else:
      cheating = True
      def playerswitch():
      player += 1
      if(player > amountofplayers):
      player = 1
      playing = True
      ui.load_view("Cheat").present("sheet")
      while playing == True:
      if cheating == False:
      Log.text = 'wrong'
      else:
      Log.text = 'right'

      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by

        view = ui.load_view('Cheat')
        view.present('sheet')
        while playing:
            view['Log'].text = 'wrong' if cheating else 'right'
        
        1 Reply Last reply Reply Quote 0
        • Baconinvader
          Baconinvader last edited by

          Thank you 😄

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors