[wxPython-users] Scrollbars around the image when button is pressed....

Varsha Purohit varsha.purohit at gmail.com
Fri Feb 1 20:40:46 PST 2008


Hi All,
    I have made a simple panel in wxpython where i am loading an image from
the folder. I have a button named zoomin. When i press this button a pair of
horizontal and vertical scrollbars should appear on the image panel nearby
image. so that we can see the zoomed image properly. I am trying to use
wx.Scrollbar but i am not able to fix the scrollbars properly around the
image. I have not added the scrollbar portion to the button handler in the
code below.. i have just commented out as its not actually working.

import wx

class ComboBox(wx.Dialog):
    def __init__(self, parent, id, title):
        wx.Dialog.__init__(self, parent, id, title, size=3D(450, 470))

        panel =3D wx.Panel(self, -1, (75, 20), (100, 127), style=3D
wx.SUNKEN_BORDER)
        self.picture =3D wx.StaticBitmap(panel)
        self.picture.SetBitmap(wx.Bitmap('srk.jpg'))
        panel.SetBackgroundColour(wx.WHITE)



        wx.Button(self, 1, 'Close', (80, 220))
        wx.Button(self, 2, 'Zoomin', (80, 280))
        self.Bind(wx.EVT_BUTTON, self.OnClose, id=3D1)
        self.Bind(wx.EVT_BUTTON, self.OnZoom, id=3D2)


        self.Centre()
        self.ShowModal()
        self.Destroy()

    def OnClose(self, event):
        self.Close()

    def OnZoom(self, event):
##        sw =3D wx.ScrolledWindow(panel)
##        sw.SetScrollbars(20, 20, 155, 40)
##        sw.Scroll(50,10)
         self.Close()

app =3D wx.App()
ComboBox(None, -1, 'picture box')
app.MainLoop()


But can please anybody suggest me how should i go ahead and solve this
problem ??


-- =

Varsha Purohit,
Graduate Student
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200802=
01/0b493625/attachment.htm


More information about the wxpython-users mailing list