clockworkpi

Give Your GS a Custom Wallpaper

Hey Friends!

I have seriously had nothing but love for this community so far and hope I can now contribute back! I’m not a Python Dev by any standard, and most definitely not a PyGame user. Anyway, I rewrote some code that allows for a wallpaper to be rendered! Heres a snap!
capture_01

I achieved this using a bit of research and a few well-placed lines of code in
/home/cpi/launcher/sys.py/UI/page.py

Specifically, you can reproduce this by adding code at these lines to page.py!

  1. Add this line of code at line 98.
    _Wallpaper = pygame.image.load("/home/cpi/launcher/skin/default/Menu/GameShell/WallPaper.png")

  2. Comment out (add ‘#’ before the line!) line 541. This line fills the screen with the default white color.

  3. Wrapping up the code portion now, create a new line below line 541, being sure to keep the same indentation.
    and add
    self._CanvasHWND.blit(self._Wallpaper,(0,0))
    This allows us to call upon our preloaded image!

  4. Finally, put your 320x240 image named WallPaper.png in /home/cpi/launcher/skin/default/Menu/GameShell.

I’ll take some time tomorrow to work to robustify the code to grab the wallpaper, and if anyone gets stuck, I can upload my page.py file!

Maybe we can start a thread a pixel art thread for sharing wallpapers?

5 Likes

Awesome!

I would really suggest forking the launcher git repository and making a pull request so this gets in to the main repo, once it’s robust enough and allows for the wallpaper to be on or off.

One big reason to do so is that local modifications will get wiped if there is an update to the launcher and you want to update to the latest. You would then have to make the changes all over again making sure they’re compatible with the latest launcher code.

Another thing to note is that @guu has mentioned that theming is being overhauled, so code like this would greatly help in making the new theming feature rich.

1 Like

Ok, I’m game. Should it look for wallpaper.png, or maybe a new directory in skin/default that it scrapes from? Anyone have input on how that process should go?

How about pick a random file from from a new directory in skin/default?

Nice work!

1 Like

Ok, took this advice! It looks for a file in
/home/cpi/launcher/skin/default/Menu/GameShell/Wallpaper/
At this point you’ll have to create that directory, as I’m having issues with os.makedirs()

The file can now be any name, MUCH less resource consumptive, and automatically scales to the screen!

Also, along the lines of compatibility, it always defaults to og code upon failure or lack of files.

Here’s the Github link to the file!