• JonB

    I'm pretty sure that shortcuts can't simulate taps into other apps. That would be a huge security risk.

    posted in General Discussion read more
  • JonB

    What type of signal processing do you need? Pythonista has numpy, so you can do certain types of processing easily (and other types with some effort)

    posted in General Discussion read more
  • JonB

    Ffmpeg cannot be installed on pythonista. Blame Apple.

    Technically, it might be possible to use the emacriptm port in a webview
    here but I've got to think it will be really slow.

    posted in Pythonista read more
  • JonB

    I believe mqtt would work -- I think it has ack/resend capability for example -- though may also be overkill. One peer would act as server (broker in mqtt parlance), and maybe would also have to run the client as well, though maybe not.

    posted in Pythonista read more
  • JonB

    @shinyformica when you say messaging, are talking about "chat" app? Or literal low level messaging for some sort of client/server application?

    I have used MQTT on embedded projects before. This is a subscribe/publish style messaging system, usually used for things like sensor data logging/distribution and control, but it is fairly low overhead and could be used as the transport for peer to peer comm. There are pure python implementations (I have used the micropython version, but there are at least a half a dozen different client implementations, a lot fewer python broker implementations that I could find)

    Of course, there is also
    https://github.com/mikaelho/multipeer

    Which uses iOS frameworks for setting up the connection.

    For very simple applications you might get by with the built in asynchat module. For example
    https://pymotw.com/2/asynchat/

    posted in Pythonista read more
  • JonB

    here is a very simple example using the built in exAmple:

        def touch_began(self,touch):
            if touch.location.x>.7*self.size.w:
                self.x_move_dir=+1
            if touch.location.x < .3*self.size.w:
                self.x_move_dir=-1
        def touch_ended(self,touch):
                self.x_move_dir=0
    

    then, you replace g.x in update_player with self.x_move_dir.
    you could have a similar logic for y motion.

    of course, this method doesnt work for multiple fingers. for that you need to keep a dictionary of touches, that gets set in touch_began (use touch.id as the key). you update the touch in touch_moved, and delete it in touch_ended. then, in your update function, you have to cycle through the active touches to see what is currently being pressed each cycle.

    posted in Pythonista read more
  • JonB

    You might consider scene instead of UI. Scene would let you animate the piece motions more naturally for example.

    posted in Pythonista read more
  • JonB

    The code isn't mine. I just adapted the speaker and screen support.

    posted in Pythonista read more
  • JonB

    Try

        img = 'rectangle_1.png'
        self.background_color = 'white'
        if img in os.listdir(): print('yes')            
        printt(ui.Image.named(img)) 
    

    You were checking one file, but trying to open a different one

    posted in Pythonista read more
  • JonB

    I am in the process of swapping out the screen code on applepy, and adding in kb support. While the screen drawing code is reasonably fast, the actual emu code is horrendously slow. So this isn't actually a viable solution for anything "real".

    posted in Pythonista read more
  • JonB

    @cvp sorry, fixed the link..

    posted in Pythonista read more
  • JonB

    Not sure about NES -- I took a shot at adapting an apple ii emulator some time ago. The original depended on pygame, or maybe some cocoa arrive, I forget.

    The difficulty you are likely to face is the lack of an easy direct screen buffer on iOS, making display very very slow. My original solution used an imageview and some numpy approaches:
    https://github.com/jsbain/applepy

    Later, in this thread, we worked out some efficient audio and iosurface methods:

    https://gist.github.com/jsbain/87d9292b238c8f7169f1f2dcffd170c8

    I should go back and update the applepy simulator.

    Something like that will probably be necessary-- I suspect an NES emulator will have screen buffers to deal with. Though as I read a little about NES, sounds like they sort of have a Sprite system which might be more directly implementable in the scene module.

    I have seen a few python emulators on GitHub for NES or Gameboy, but not sure how many of them are pure python, or truly finished.

    posted in Pythonista read more
  • JonB

    except Exception is also a little questionable -- you are probably getting a specific exception , catch that one.

    while True is probably okay, just make sure there is a parh to exit the loop.

    posted in Pythonista read more
  • JonB

    TLDR: no, you cannot install pandas, or upgrade numpy, or install any package that relies on c or Fortran, as iOS does not allow unsigned executable code. If those are priorities, you should consider pyto, found in the app store, which does have pandas support.
    If you tried to install these, go to the site-packages folder and delete any numpy folders you find -- no need to reinstall the app.

    posted in Pythonista read more
  • JonB

    Don't create infinite loops.

    The X in the console basically issues a KeyboardInterrupt. But if your loop uses try/except all, you won't be able to cancel it. Be sure to always only catch the exceptions specific to your code.

    posted in Pythonista read more
  • JonB

    I wonder if we shouldn't all switch over to pybee Rubicon. @dgelessus has helped make that library really complete and easy to use. For instance, there is a nice decorator system for defining classes, and I think they have a working super. . Also, their type parsing I think is a lot more complete, and memory management is more robust.

    Anyway the discussion where they got super working us here
    https://github.com/beeware/rubicon-objc/pull/108
    Some of that might be useful to the op in getting it working, but you'll have to implement some of what Rubicon does using objc_util.

    posted in Pythonista read more
  • JonB

    I think he is talking the method on an instance.

    You might be able to construct the ObjcInstanceMethod directly. But otherwise you need to use

    objc_msgSendSuper

    To formulate the objc message manually.

    posted in Pythonista read more
  • JonB

    I think your best bet is to use objc. The cb module is fairly limited.

    posted in Pythonista read more
  • JonB

    You ought to be able to use ui.in_background as a decorator, and eliminate the other places you use it.

    posted in Pythonista read more
  • JonB

    Does pyto offer a pyobjc type module?

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!