Lighting (thunderbolt) on button onMouseOver

First, HELLO EVERYONE :D, I am new to wxPython, playing with it for few hours now. Some time ago, i started some sort of roguelike as my python learning project, game was in pygame, but i made "map editor"
  with wxpython, there i used only basic things.

I tried to create button which will play lighting animations when mouse is over them, i understand events, but i cant find my way with drawing on button.

For example if button is 100x100 i would randomly create line(s) which would look like thunderbolt is striking the button, eg lines (button local coords) (10,0,30,20) and (30,20,70,100) that lines should be on button for like 0.2 secs, then they should dissappear and some different lines should appear, and over and over again as long as mouse is on button.
Is this even possible in wxPython and if it is, could someone point me in some direction how to achieve that.

I have gone as far as drawing horizontal red line over a button, but that button would then dissapear. I would see only red line on background.

PS sorry for my bad english :slight_smile:

First, HELLO EVERYONE :D, I am new to wxPython, playing with it for few hours now.

Welcome.

Some time ago, i started some sort of roguelike as my python learning project, game was in pygame, but i made "map editor"
with wxpython, there i used only basic things.

I tried to create button which will play lighting animations when mouse is over them, i understand events, but i cant find my way with drawing on button.

What about using a bitmapButton?

For example if button is 100x100 i would randomly create line(s) which would look like thunderbolt is striking the button, eg lines (button local coords) (10,0,30,20) and (30,20,70,100) that lines should be on button for like 0.2 secs, then they should dissappear and some different lines should appear, and over and over again as long as mouse is on button.
Is this even possible in wxPython and if it is, could someone point me in some direction how to achieve that.

Hmm, I'm not totally sure what to picture, but you could continually
swap out two bitmaps from the button and maybe get the effect you
want. You'd use a timer to time the swapping. In the attached code,
it does this. Just put the two attached images on your desktop and
change the lines that point to the desktop to match your path.

PS sorry for my bad english :slight_smile:

Reads fine to me.

Che

Apic_blue.jpg

Apic_red.jpg

flickerbutton.py (2.32 KB)

···

On Sat, Feb 21, 2009 at 9:22 PM, Marin Grizelj <marin.grizelj@fer.hr> wrote: