I am playing with this to create a scrollable matplotlib plot with wxPython. However, when I run this code on my Windows 7 machine at work, the scrollbar does not work properly. In particular, if I click and drag it to a place, then it updates the plot, but then the scrollbar takes it back instead of back to its starting position. I'm curious if anyone came to know That's what's happening here. FWI, this code works fine when I went to my Linux Mint 14 machine at home
Right now, I'm trying to fix this by using a wx.ScrolledWindow or wx.lib.scrolledpanel As an example, instead of directly adding scrollbar to the canvas. I was thinking of using the slider instead of scrollbar
thanks
From (emphasis my) ...
When you use scroll bars inside your program, you take responsibility with Windows to maintain scroll bars and scroll bar thumb Update the situation. These Windows have responsibilities for scroll bars:
- Handle all the processing of mouse messages in the scroll bar.
- When a user clicks, provide a reverse-video "flash" scroll bar.
- As the thumb moves, the user leaves the thumb inside the scroll bar.
- Send scroll bar messages in the window window window scroll bar with scroll bar.
These are your program responsibilities:
- Start the border and position of the scroll bar.
- Process window process on scroll bar messages.
- Update the thumb position of the scroll bar.
- Change the content of the customer area in response to any change in the scroll bar.
... Anywhere ... code on the OnScrollEvt () method you must call something like ...
< Code> self.canvas.SetScrollPos (wx.HORIZONTAL, event.GetPosition (), True)
No comments:
Post a Comment