简体   繁体   中英

Code changes - Python - Piphone - Raspberry Pi

Right now I'm working hard to finish a project named Pihpone; I've been following the adafruit tutorial and I've also bought all the items that were suggested by them

The problem is that..the code was written for 2,8" while I have a 3.5" screen

I've succeeded in making some changes like modifying the 320x240 with 480x320

Still not enough but I dont know what to do further; pls come with any suggestion;

Here are the screenshots:
Before
After

https://github.com/climberhunt/Piphone/archive/master.zip From there you can download the code made by Adafruit; you can find the code in piphone.py.

The code in piphone.py appears to be using the pygame module to do the graphics. The problem is all the hardcoded coordinates and sizes for things like the Button s. To fix this, the values must be computed at run-time and depend on the display resolution. Line 255 sets the display mode.

screen = pygame.display.set_mode(modes[0], FULLSCREEN, 16)

After doing that, you can get a video display information object from pygame.display.Info() and obtain the width and height of the current video mode, then use those values to scale and position the buttons.

You may also need to create different sets of image files for the various sizes of display you want the program to support.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM