i've made a little animation using python and the pygame module,
I'm just wondering if it's possible to turn that into a screensaver?
is there a format i have to save it to?
If anyone knows i would be grateful for the solution
thanks,
a1eio
i've made a little animation using python and the pygame module,
I'm just wondering if it's possible to turn that into a screensaver?
is there a format i have to save it to?
If anyone knows i would be grateful for the solution
thanks,
a1eio
On Windows, a saver is just a normal app that must respond to the standard switches Windows passes it. That is the missing piece hinted at by and . Handle these at startup: /s to run full screen, /c to open a settings UI, and /p <hwnd> for the tiny preview thumbnail. Microsoft documents these options here. Command Line Options
Quick wiring for a pygame saver loop (trim to your animation):
import sys, pygame
def run_saver():
pygame.init()
screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
pygame.mouse.set_visible(False)
clock = pygame.time.Clock()
running = True
while running:
for e in pygame.event.get():
if e.type in (pygame.KEYDOWN, pygame.MOUSEBUTTONDOWN, pygame.MOUSEMOTION, pygame.QUIT):
running = False
# draw your animation frame here
pygame.display.flip()
clock.tick(60) # be nice to CPU
if __name__ == "__main__":
args = " ".join(sys.argv[1:]).lower()
if args.startswith("/c"): sys.exit(0) # no config UI
if args.startswith("/p"): sys.exit(0) # preview not implemented
run_saver() # /s or no args To package, is right about dependencies; use PyInstaller for Python 3 rather than py2exe. Build a GUI exe and then use the onedir layout to avoid slow startup caused by onefile extraction. Using PyInstaller How onefile extracts to a temp folder
pyinstaller --onedir --windowed your_saver.py Install your saver for testing without touching the registry UI:
rundll32.exe desk.cpl,InstallScreenSaver C:\path\to\your_saver.scr Windows accepts the .scr path via that command. InstallScreenSaver via rundll32
Practical tips: cap your FPS, hide the cursor, exit immediately on any user input, and test with multiple monitors. If you eventually add a settings dialog, show it only when launched with /c.
Jump to Post— bumsfeld 413Thinking about the way it's done with C on Windows, and that you have to create an certain .exe file and then rename to .scr
This might be not doable in Python since it does not make .exe file.Also looks like it might be highly specific to the …
Jump to Post— shanenin 0just yesterday i was googling around for infomation about this, I came across this link, it might have some info
Jump to Post— G-Do 19You could always make a .exe file that calls the Python script, then rename that to .scr, right?
Thinking about the way it's done with C on Windows, and that you have to create an certain .exe file and then rename to .scr
This might be not doable in Python since it does not make .exe file.
Also looks like it might be highly specific to the operating system you have.
hehe however py2exe might be able to do it, thanks anyway i'll look into it
just yesterday i was googling around for infomation about this, I came across this link, it might have some info
You could always make a .exe file that calls the Python script, then rename that to .scr, right?
see thread here:
http://www.daniweb.com/techtalkforums/post300206.html#post300206
scr is just an exe that does anything so i suppose you could get it to call your python script
I suggest a book that will help you with alot of the programming that you would need to learn. I suggest "Beginning Game Development with Python and Pygame from Novice to Professional" by Will McGugan
i've made a little animation using python and the pygame module,
I'm just wondering if it's possible to turn that into a screensaver?
is there a format i have to save it to?If anyone knows i would be grateful for the solution
thanks,
a1eio
When you generate an .exe with py2exe it also makes other files that I think the .exe is dependent on. Like some .pyd files and such. Well, all the .exes I generated with py2exe did that for me, at least. I may have been doing something wrong though, as I haven't used py2exe very much...
I have not had much experience with python. All I can tell you is seek advice from people that understand more on what you are talking about. I have seen it in the book I have on more about py2exe. I do not know alot about it but I am sure I will be learning more about it.
Ok then. It took me a little while to grasp py2exe's workings, but not too long. If you were to follow the tutorial then you'll be fine. Good luck with this idea!
Setting up py2exe can be tedious Job, but Andrea Gavana have done such plausible work to make a GUI.
http://code.google.com/p/gui2exe/
I have made DrPython to exe and packed it with Inno setup compiler and It works wonderfully! So If you think of making exe, then I think it is a way to go!
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.