On 4/18/20 5:44 AM, Ranjan Maitra wrote:
On Fri, 17 Apr 2020 22:51:22 -0700 Paul Allen Newell <pnewell0...@gmail.com> 
wrote:

On 4/17/20 5:53 PM, Ranjan Maitra wrote:
So, I was able to hack out a python script [...]
Ranjan:

Thank you for the script .. with modifications I have it running under
python3

Paul
Thanks, Paul, and no problem. This is a place for sharing. I am just curious: 
what modifications did you need? Mine works with python3 (on F31).

Ranjan
_______________________________________________

Ranjan:

I misphrased my statement about those modifications. It wasn't to get it running on python3 per se. It was to give it more flexibility.

I added the following snippet inside the loop so I can run the script (or any script using pygame) in a non-interactive fashion so the "X" for "Close Window" in the menubar of the screen works (needed to make "(width, height) = (80, 80)" to see that "X"):

[...]
while running:
    if (event.type == pygame.QUIT):
        running = False
[...]

and added this at the end for when we exit the loop:

[...]
pygame.quit()
sys.exit (0)
[...]

I also added an "import os" and the following code before "pygame.init()" to allow me to position the screen

[...]
(xpos, ypos) = (100, 100)
os.environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" % (xpos, ypos)
pygame.init()
[...]

Paul


_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org

Reply via email to