Re: OT: simplest way to display on-screen blinking colored indicator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 4/18/20 5:44 AM, Ranjan Maitra wrote:
On Fri, 17 Apr 2020 22:51:22 -0700 Paul Allen Newell <pnewell0705@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux