I don't see any reason why that shouldn't work. I can confirm that it works quite well in Dabo, using the dImage control, which is a subclass of wx.StaticBitmap. Note how much simpler creating an image is: just pass a file path to the Picture property of the dImage, and it does all that annoying conversion stuff for you.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
import wx
import dabo
dabo.ui.loadUI("wx")
class DemoForm(dabo.ui.dForm):
def afterInit(self):
self.Caption = "Image Click Demo"
self.Size = (500, 260)
f = dabo.ui.getFile("jpg")
img = dabo.ui.dImage(self, Picture=f, RegID="img")
self.Sizer.append1x(img)
self.layout()
def onMouseMiddleClick_img(self, evt):
dabo.ui.info("Image Middle Click")
def onMouseMiddleDoubleClick_img(self, evt):
dabo.ui.info("Image Middle Double Click")
def main():
app = dabo.dApp()
app.MainFormClass = DemoForm
app.start()
if __name__ == '__main__':
main()
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
···
On Nov 11, 2005, at 1:37 PM, iuri Matias wrote:
how do i associate a event to a image? i tryed :
c = wx.Image(imageFile,wx.BITMAP_TYPE_ANY)
d = c.ConvertToBitmap()
id = wx.NewId()
b = wx.StaticBitmap (self, id, d, (10 + d.GetWidth(), 5), (d.GetWidth(), d.GetHeight())) b.Bind(wx.EVT_MIDDLE_DCLICK, self.function,id= id)but nothing happens when i try this event on the image (it works in other widgets).
whats, the "best" class to use, in order to display a image in a frame, that can be easily resized, moved, and have events associated with. (i see (too) many but little examples )