omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. misha_turnbull
    3. Topics

    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 11
    • Posts 35
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by misha_turnbull

    • misha_turnbull

      PhantomChess
      Pythonista • • misha_turnbull

      4
      0
      Votes
      4
      Posts
      3197
      Views

      ccc

      PhantomChess has been getting quite a few updates in recent weeks and it would be good to get feedback from others. It is a Python-based Chess game that has three modes of operations in Pythonista. It starts up in text-only mode where it takes commands on the interactive prompt. The gui command switches it into a ui/scene based gui mode. The sk command switches it into a ui/sk based gui mode for those who are running the Pythonista v1.6 beta.

      To install Phantom, copy the text of Phantom_installer.py into a new Pythonista script window and run it. A local Phantom directory will be created with a Run_this.py file in it. To improve PhantomChess Please open issues or send pull requests.

    • misha_turnbull

      Data from Editorial?
      Pythonista • • misha_turnbull

      1
      0
      Votes
      1
      Posts
      1226
      Views

      No one has replied

    • misha_turnbull

      Bug report
      Pythonista • • misha_turnbull

      5
      0
      Votes
      5
      Posts
      3128
      Views

      Gerzer

      @Saturn031000 This is a known bug for all system text input alerts in Pythonista, and is (I think) fixed in the current 1.6 beta.

    • misha_turnbull

      scene.rect
      Pythonista • • misha_turnbull

      3
      0
      Votes
      3
      Posts
      2070
      Views

      misha_turnbull

      That was indeed the issue. Thank you!

    • misha_turnbull

      scene.load_pil_image
      Pythonista • • misha_turnbull

      4
      0
      Votes
      4
      Posts
      2758
      Views

      misha_turnbull

      @JonB I import img_names in the main part of the file -- I'll shift it to be in the setup and load it into a list. Originally I had been using load_image_file but I thought I'd rule out the possibility it was that causing the problem so I switched to load_pil_image. I'm assuming load_image_file is faster and will switch back to that.

      @ccc do you think it would be possible to load the images into a dictionary? I'd prefer not to use a list as that might end up needing exec or eval() neither of which are good. From the piece class itself (as youll be able to see shortly - I'm uploading the code today) I have the 'color' and 'ptype' attributres which respectivley represent the color and piece type eg. 'white' & 'pawn'. This would allow me to use a dictionary with keys like {'white_pawn': xxx, 'black_king': yyy} and I could use a loop to render the images something like:

      for piece in self.game.board.pieces: img = self.images['{}_{}'.format(piece.color.color, piece.ptype)] scene.image(img, x, y)

      as opposed to having to do something long and complicated with types of the piece etc.

    • misha_turnbull

      How to export sprites
      Pythonista • • misha_turnbull

      5
      0
      Votes
      5
      Posts
      3519
      Views

      misha_turnbull

      Came up with my own solution after running into some problems with the get_remote_resources() method (the zip file kept getting corrupted in the download process): I loaded the images into Pythonista using a computer program called iFunBox and used the scene.load_image_file() function.

      In the mean time, I have also completely restarted the project from scratch (but mostly just have the GUI left to do) so it'll be some time before it's uploaded.

    • misha_turnbull

      Windows version of scene module?
      Pythonista • • misha_turnbull

      3
      0
      Votes
      3
      Posts
      3816
      Views

      JonB

      https://github.com/Vik2015/pythonista-pc/

    • misha_turnbull

      Arrays
      Pythonista • • misha_turnbull

      2
      0
      Votes
      2
      Posts
      1622
      Views

      polymerchm

      Your should read up on numpy. Its all there and coded efficiently.

    • misha_turnbull

      Module grabber
      Pythonista • • misha_turnbull

      5
      0
      Votes
      5
      Posts
      2823
      Views

      pacco

      Thanks for the useful tool. Python is still relatively new to me and whenever learning a new language it always helps to spend as much time as possbile reading existing code. The Python standard library modules are ideal sources (pun intended) for code to study.

    • misha_turnbull

      Number factorizer
      Pythonista • • misha_turnbull

      3
      0
      Votes
      3
      Posts
      2253
      Views

      ccc

      fmath.is_prime() is slowing you down...

      I will post some replacement code on the gist.

      ======================= Running timing tests... newer_is_prime() 4.03963088989 new_is_prime() 11.5599570274 is_prime() 138.246795177 done.
    • misha_turnbull

      math.pow() problem
      Editorial • • misha_turnbull

      3
      0
      Votes
      3
      Posts
      1670
      Views

      omz

      The problem is that 1/2 evaluates to 0 because you're dividing two integers, if you use 1.0/2.0 instead, you should get the expected result (1./2 is actually enough).