omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. SteveIves

    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.


    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 7
    • Best 0
    • Controversial 0
    • Groups 0

    SteveIves

    @SteveIves

    0
    Reputation
    706
    Profile views
    7
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    SteveIves Unfollow Follow

    Latest posts made by SteveIves

    • Help with UI and views.

      I'm trying to put a UI on a classic 'Star Trek' game written in Python.

      To start with, I want a full-screen background onto which I can put my long-range scanner, my short range scanner, a command menu and perhaps some other boxes.

      Would I create a full-screen ui.view for the background and then ui.view subviews for the scanners etc?

      Thanks,

      Steve

      posted in Pythonista
      SteveIves
      SteveIves
    • RE: Help with UI and views.

      The current version, which runs under Pythonista, looks like this :
      alt text

      When you enter your command, the game's status is simply printed as text and everything scrolls up, and you are then prompted to enter your command again.

      posted in Pythonista
      SteveIves
      SteveIves
    • RE: Help with UI and views.

      Hi. no, this is basically the original text-based Star Trek with text input and output. the UI I'm aiming for is something like this : alt text

      so you enter your move as text and the status of the universe is then updated and the screen re-drawn.

      posted in Pythonista
      SteveIves
      SteveIves
    • RE: Space Shooter (Game for iPad)

      Just found this and notices that the sprites png file has been moved. Can it be found elsewhere or do you mind if I create my own?

      Thanks,

      Steve

      posted in Pythonista
      SteveIves
      SteveIves
    • Rendering text (for classic 'Star Trek' game) using scene?

      I've found a Python version of the classic text-based 'Star Trek' game. It writes loads of text to the console for star-field displays etc.

      I'd like to rewrite it with a static text display that updates in place, and though that the 'scene' module would be the best way to do it, but I'm obviously not understanding how the 'scene' module works.

      For example: I want to display the intro text, so I've coded the following:

      	import console
      	from scene import *
      	import time
      
      	class MyScene(Scene):
      
              def draw(self):
                      pass
      
              def setup(self):
                      global screen
                      screen = self.size
                      w, h = self.size.w, self.size.h
                      self.graphicBlurb()
      
              def graphicBlurb(self):
                      blurb = []
                      blurb.append("Space ... the final frontier.")
                      blurb.append("These are the voyages of the starship Enterprise")
                      blurb.append("Its five year mission ...")
                      blurb.append("... to boldly go where no-one has gone before")
                      blurb.append("You are Captain Kirk.")
                      blurb.append("Your mission is to destroy all of the Klingons in the galaxy.")
      
                      #font_size = 60 if self.size5.w > 700 else 40
                      yOffset = screen.h/(len(blurb))
                      yPos = screen.h
                      for line in blurb:
                              text(line,'GillSans',40,screen.w/2,yPos)
                              print "Printing {0} {1}".format(line,time.localtime())
                              time.sleep(1.5)
                              yPos -= yOffset
      
      	trekGame = MyScene()
      	run(trekGame)
      
      

      but when I run this, instead of the lines of text appearing one at a time down the screen, I get a black screen for about 10.5 seconds, then all the text appears at once.

      I'm guessing that it's running the 'setup' method but nothing is appearing on screen until the 'draw' method is called.

      What's the best way to do this, or is 'scene' only for programs that need to 60fps gameloop and should I be using the 'ui' module instead?

      Thanks,

      Steve

      posted in Pythonista
      SteveIves
      SteveIves
    • RE: Rendering text (for classic 'Star Trek' game) using scene?

      Thanks Jon. As this is a text-heavy game, I think that a 'ui' based interface will work better.

      posted in Pythonista
      SteveIves
      SteveIves
    • Relationship between the .py and the .pyui files?

      Hi,

      Just getting started with using the Pythonista UI builder.

      If I select 'Script with UI' and I call my file 'Test UI', then I get an empty Test UI.pyui file and a Test UI.py file with just an 'import ui' in it. Touching the button on the screen flip-flops between the 2 files.

      Am I correct in thinking that my actual code goes in a separate source file (e.g. Test Code.py) in which I reference 'Test UI', or should my code go in the 'Test UI.py' file?

      Thanks in advance for advice.

      posted in Pythonista
      SteveIves
      SteveIves