[wxPython-users] Binding button even with another class
Varsha Purohit
varsha.purohit at gmail.com
Thu Feb 7 12:21:03 PST 2008
Hello All,
I have a simple application where there is a frame which has one
image and a zoomin button. when i am clicking on the zoomin button it should
call another class which will display another version of the image saved in
local copy which is zoomed. But i am not getting any error but even the new
image is not being displayed. can you please check and tell me wher ei am
doing mistake. Actually when i click zoomin another window should come on
top of the frame which will have scrollbars and show the new zoomed image.
this is my code : -
import wx
class ScrolledWindow(wx.Panel):
def __init__(self, parent, id=3D-1):
wx.Panel.__init__(self, parent, id=3D-1)
#Display the zoomed version of the image in the panel.
sw =3D wx.ScrolledWindow(self)
bmp =3D wx.Image('Nearest.jpg',wx.BITMAP_TYPE_JPEG).ConvertToBitmap=
()
wx.StaticBitmap(sw, -1, bmp, (120,250), (580,400))
sw.SetScrollbars(20, 20, 55, 40)
#sw.Scroll(50,10)
self.Centre()
self.Show()
class MyFrame(wx.Frame):
def __init__(self, parent, id):
# create a panel
wx.Frame.__init__(self, parent, id=3D-1, size =3D (820, 710))
self.SetBackgroundColour("white")
self.bmp =3D wx.Image('srk.jpg',wx.BITMAP_TYPE_JPEG).ConvertToBitma=
p()
wx.StaticBitmap(self, -1, self.bmp, (120,250), (580,400))
self.button11 =3D wx.Button(self, -1, "Zoom in", (30,240))
self.button11.Bind(wx.EVT_BUTTON, self.resizeImage)
self.Centre()
self.Show()
def resizeImage(self, event):
panel =3D ScrolledWindow(self)
app =3D wx.PySimpleApp()
# create a window/frame, no parent, -1 is default ID, title, size
MyFrame(None, -1)
# start the event loop
app.MainLoop()
p.s: You have to save two images in the local folder where you are saving
this file.
-- =
Varsha Purohit,
Graduate Student
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200802=
07/df44206d/attachment.htm
More information about the wxpython-users
mailing list