2

I'm working on a small pygame app using a Pi 1 Model A but have noticed that it performs worse/differently as a kiosk app (run from command line without starting LXDE) than starting LXDE and running the same commands (change to the directory and call python3 with the script) in a terminal window.

How is it worse? The script renders 3 surfaces beside each other, each has a number (rendered with a freestyle font) and they increment like a timer (000 => 001 etc). There is one call to display update when a value changes (can be one value or all three, but only in cycles with a change) and only the portions of the screen containing the changed surface/s are updated. Double buffering is not enabled (found it behaved differently between the environments and wasn't benefiting from it). Running this from the GUI looks perfect and smooth, running from the CLI when more than one surface updates (e.g. 009 => 010) you can see the surfaces update one at a time, one after each other (ideally they would instantaneously all change like in the GUI).

I've done my best to optimise what I have but I can't get it fast enough, I would have assumed performance would be better without loading LXDE.

I'm wondering what the difference between these two environments for a python/pygame script is and if something can be done in the command line to run it like the GUI (...without starting the GUI as its to be a kiosk app)?

4
  • 1
    It's not clear from this but I presume by "not using LXDE" you mean you are not using the X server at all but instead some kind of python lib for the framebuffer? Or you are using X, and this is just what happens without a window manager?
    – goldilocks
    Commented Apr 11, 2016 at 16:10
  • 2
    Okay, so I think you are using the framebuffer with no X. No, that probably won't work as well and seems like a goofy feature that someone built into pygame just to do it. You should try using X without LXDE and run it as a single app inside that.
    – goldilocks
    Commented Apr 11, 2016 at 16:12
  • Thanks for your comments @goldilocks, these pointed me in the right direction, I had no idea about running X server and avoiding the windows manager, sorry I can't upvote anything for you :-s
    – Paddy
    Commented Apr 18, 2016 at 12:50
  • I'm happy to hear that you figured it out from there. I didn't have time at that point to write a proper answer, so thank you for coming back and providing one that you can claim actually works!
    – goldilocks
    Commented Apr 18, 2016 at 13:04

1 Answer 1

1

Thank you @goldilocks for your comments on this, to clarify what I was doing: the pi was booting to the cli and here there was a script in init.d to run the python/pygame script. I wasn't using the X server at all.

From your comments I've looked into using X server without the windows manager (which I had no idea about), using these sources:

This Xclients answer didn't work for me on a Pi 1 Model A running Raspbian Jessie

From comments in the previous link this was helpful, by copying xinitrc (creating ~/.xinitrc) and calling the script in it on start x the pygame app runs

Step by step instructions to have an app launch on start up without windows manager using .xinitrc

So the app is running on startup, the rendering of the three now happens instantaneously (which was the problem). If I put the app into windowed mode I see the mouse is rendered with an 'x' which I believe indicates I now have X server running.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.