Python Forum

Full Version: Bouncing Ball
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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()