Animated Gif as Button

Message
Hi,

Sorry for what may seem to be a noob question, but its the last thing holding me back before my project would be complete. I simply need to create a button which displays an animated gif (exactly like a clickable ‘banner ad’ on 99% of web-pages). Unfortunately, I can’t do it in a mini wx.html panel, it needs to be within a frame. Does anyone have any ideas?

many thanks,

Ben Harling

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please reply to this email and then delete it. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Future.

The recipient should check this email and any attachments for the presence of viruses. Future accepts no liability for any damage caused by any virus transmitted by this email.

Future may regularly and randomly monitor outgoing and incoming emails and other telecommunications on its email and telecommunications systems. By replying to this email you give your consent to such monitoring.

wx has a wx.animate module that has a GIFAnimation class. You should just be able to place one of those within your frame.

Ben Harling wrote:

···

Hi,
Sorry for what may seem to be a noob question, but its the last thing holding me back before my project would be complete. I simply need to create a button which displays an animated gif (exactly like a clickable 'banner ad' on 99% of web-pages). Unfortunately, I can't do it in a mini wx.html panel, it needs to be within a frame. Does anyone have any ideas?

Aha, yes. I can display the animated gif, but I need to register when the user clicks it, I cant seem to find any method to do this. You cannot use an wxGifAnimationCtrl with a bitmap button. I have looked into using Rect.inside(mouseClickLocation) but it seems there must be a better way to do it. I have also tried placing an emtpy bitmap button below the animated gif, but the bitmapButton wont receive clicks... :frowning:

···

-----Original Message-----
From: Kent Quirk [mailto:kent_quirk@cognitoy.com]
Sent: 02 August 2006 15:06
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] Animated Gif as Button

wx has a wx.animate module that has a GIFAnimation class. You should just be able to place one of those within your frame.

Ben Harling wrote:

Hi,

Sorry for what may seem to be a noob question, but its the last thing
holding me back before my project would be complete. I simply need to
create a button which displays an animated gif (exactly like a
clickable 'banner ad' on 99% of web-pages). Unfortunately, I can't do
it in a mini wx.html panel, it needs to be within a frame. Does anyone
have any ideas?

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please reply to this email and then delete it. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Future.

The recipient should check this email and any attachments for the presence of viruses. Future accepts no liability for any damage caused by any virus transmitted by this email.

Future may regularly and randomly monitor outgoing and incoming emails and other telecommunications on its email and telecommunications systems. By replying to this email you give your consent to such monitoring.

Ben Harling wrote:

Aha, yes. I can display the animated gif, but I need to register when
the user clicks it, I cant seem to find any method to do this. You
cannot use an wxGifAnimationCtrl with a bitmap button. I have looked
into using Rect.inside(mouseClickLocation) but it seems there must be
a better way to do it. I have also tried placing an emtpy bitmap
button below the animated gif, but the bitmapButton wont receive
clicks... :frowning:

Bind the mouse events to the GifAnimationCtrl and implement your own button-like behavior.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks Robin, Apologies, but how do I do that? ( my noobness is now properly exposed..)

···

-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: 02 August 2006 16:13
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] Animated Gif as Button

Ben Harling wrote:

Aha, yes. I can display the animated gif, but I need to register when
the user clicks it, I cant seem to find any method to do this. You
cannot use an wxGifAnimationCtrl with a bitmap button. I have looked
into using Rect.inside(mouseClickLocation) but it seems there must be
a better way to do it. I have also tried placing an emtpy bitmap
button below the animated gif, but the bitmapButton wont receive
clicks... :frowning:

Bind the mouse events to the GifAnimationCtrl and implement your own button-like behavior.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please reply to this email and then delete it. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Future.

The recipient should check this email and any attachments for the presence of viruses. Future accepts no liability for any damage caused by any virus transmitted by this email.

Future may regularly and randomly monitor outgoing and incoming emails and other telecommunications on its email and telecommunications systems. By replying to this email you give your consent to such monitoring.

Done it, thanks again Robin, sorry to clutter up the mailing list.

Code:
Self.AdBanner.Bind(wx.EVT_LEFT_UP, self.AdBannerClicked, self.AdBanner)

So simple... !

···

-----Original Message-----
From: Ben Harling [mailto:benjamin.harling@futurenet.co.uk]
Sent: 02 August 2006 16:18
To: wxPython-users@lists.wxwidgets.org
Subject: RE: [wxPython-users] Animated Gif as Button

Thanks Robin, Apologies, but how do I do that? ( my noobness is now properly exposed..)

-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: 02 August 2006 16:13
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] Animated Gif as Button

Ben Harling wrote:

Aha, yes. I can display the animated gif, but I need to register when
the user clicks it, I cant seem to find any method to do this. You
cannot use an wxGifAnimationCtrl with a bitmap button. I have looked
into using Rect.inside(mouseClickLocation) but it seems there must be
a better way to do it. I have also tried placing an emtpy bitmap
button below the animated gif, but the bitmapButton wont receive
clicks... :frowning:

Bind the mouse events to the GifAnimationCtrl and implement your own button-like behavior.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please reply to this email and then delete it. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Future.

The recipient should check this email and any attachments for the presence of viruses. Future accepts no liability for any damage caused by any virus transmitted by this email.

Future may regularly and randomly monitor outgoing and incoming emails and other telecommunications on its email and telecommunications systems. By replying to this email you give your consent to such monitoring.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please reply to this email and then delete it. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Future.

The recipient should check this email and any attachments for the presence of viruses. Future accepts no liability for any damage caused by any virus transmitted by this email.

Future may regularly and randomly monitor outgoing and incoming emails and other telecommunications on its email and telecommunications systems. By replying to this email you give your consent to such monitoring.

Ben Harling wrote:

Done it, thanks again Robin, sorry to clutter up the mailing list.

Code:
Self.AdBanner.Bind(wx.EVT_LEFT_UP, self.AdBannerClicked, self.AdBanner)

So simple... !

Yep.

If you want to get a little fancier and make it look/act like a real button you could derive a class from one of the generic button classes in wx.lib.buttons and instead of drawing a normal wx.Bitmap for it's label use a wx.animate.GIFAnimation to get the frames and delays from a GIF file and draw those for the label using a timer. It would be a good exercise to help you get over your noobiness :wink:

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!