Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bouncing Ball
#1
Hi,

New(ish) Python user here. I'm trying to create a (Windows) program that places a sprite (a small bouncing ball) directly on the screen, on top of any other display windows. It needs to not receive user input/keyclicks/mouse message/etc. Is there a way to do without creating it as a transparent, non-rectangular window? If I need to take the windowed route, are there any particular UI libraries that might be best for it? Thanks for any help.
Reply
#2
Apparently.attributes('-alpha', 0.0)works on some systems but not all. It didn't work on mine but I though you might want to give it a try. This will stay on screen until you press enter.
from tkinter import Tk, Label, Canvas

box = Tk ()
box.geometry ('50x50+700+400')
box.attributes('-alpha', 0.0)
box.overrideredirect (1)
canvas = Canvas (box)
canvas.pack ()
canvas.create_oval (1, 1, 48, 48, fill = 'red')

input ()
box.destroy ()
box.mainloop()
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020