I have developed a program that draws buttons and connects them with Paint
Event, and almost everything seems to work fine. My problem is, sometimes the
stuff that I draw is bigger than the actual frame, and the scrolling of the
window doesn't work. I have tried wx.ScrolledWindow and setting the flags
wx.VSCROLL and wx.HSCROLL, also without success. Does anybody have any idea
what I am doing wrong? I am adding the elements to be drawn to a wx.Panel,
whose parent is wx.Frame.
Any help would be appreciated,
Jarno
ps. below some sample to show relation of Frame and Panel, and the buttons etc.
come to Panel. Should the scrolling be enabled typically in Frame or in
Panel??
I think what you want is a wx.ScrolledWindow here.
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
I have developed a program that draws buttons and connects them with Paint
Event, and almost everything seems to work fine. My problem is, sometimes the
stuff that I draw is bigger than the actual frame, and the scrolling of the
window doesn't work. I have tried wx.ScrolledWindow and setting the flags
wx.VSCROLL and wx.HSCROLL, also without success.
IIRC, wx.ScrolledWindow always turns on the wx.VSCROLL and wx.HSCROLL styles, however the scrollbars are only shown if the virtual size is larger than the client size. After that everything is automatic. Did you try setting the virtual size and the scroll rate?
Does anybody have any idea
what I am doing wrong? I am adding the elements to be drawn to a wx.Panel,
Use a wx.ScrolledWindow. Doing your own scrolling on other window types is possible, but is more advanced and complex.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
wx.Frame -> wx.Panel -> Content (Buttons and connectors etc.)
Am I supposed to replace the wx.Frame by wx.ScrolledWindow, or should I put the
ScrolledWindow as the parent of wx.Frame?
I tried wx.ScrolledWindow so far only quickly, just to notice that I didn't know
yet how it works.. :). So I didn't set scrollrate or virtual size. I will give
it a better try now.
Jarno
Quoting Robin Dunn <robin@alldunn.com>:
···
Jarno Väyrynen wrote:
> Hi,
>
> I have developed a program that draws buttons and connects them with Paint
> Event, and almost everything seems to work fine. My problem is, sometimes
the
> stuff that I draw is bigger than the actual frame, and the scrolling of
the
> window doesn't work. I have tried wx.ScrolledWindow and setting the flags
> wx.VSCROLL and wx.HSCROLL, also without success.
IIRC, wx.ScrolledWindow always turns on the wx.VSCROLL and wx.HSCROLL
styles, however the scrollbars are only shown if the virtual size is
larger than the client size. After that everything is automatic. Did
you try setting the virtual size and the scroll rate?
> Does anybody have any idea
> what I am doing wrong? I am adding the elements to be drawn to a wx.Panel,
Use a wx.ScrolledWindow. Doing your own scrolling on other window types
is possible, but is more advanced and complex.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-dev-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-dev-help@lists.wxwidgets.org
Apart from your good tips, I haven't got this to work yet.
Let me describe shortly my situation. I have three classes in my program. They
all are of type wx.Frame. The first wx.Frame object is the parent of the second
wx.Frame, and the second is the parent of the third wx.Frame.
On top of the third wx.Frame I now try to put the wx.ScrolledWindow instead of
the wx.Panel. Everything works fine apart from the scrollbars that don't even
come visible. As I construct the wx.Frame, I so for set the size for them as
big as I can (because I don't know how to scroll). May this destroy my efforts
to scroll? Is it normal to have wx.Frame as parent of wx.ScrolledWindow?
Below is the code where in second wx.Frame class an object the third is
constructed, where the ScrolledWindow that I would like to be scrollable
appears.
···
_________________________
In 2nd wx.Frame Class:
rf=RuleFrame.RuleFrame(parent=self,id=wx.ID_ANY,size=(1600,1200),
style=wx.DEFAULT_FRAME_STYLE|wx.SUNKEN_BORDER,)
Jarno Väyrynen wrote:
> Hi,
>
> I have developed a program that draws buttons and connects them with Paint
> Event, and almost everything seems to work fine. My problem is, sometimes
the
> stuff that I draw is bigger than the actual frame, and the scrolling of
the
> window doesn't work. I have tried wx.ScrolledWindow and setting the flags
> wx.VSCROLL and wx.HSCROLL, also without success.
IIRC, wx.ScrolledWindow always turns on the wx.VSCROLL and wx.HSCROLL
styles, however the scrollbars are only shown if the virtual size is
larger than the client size. After that everything is automatic. Did
you try setting the virtual size and the scroll rate?
> Does anybody have any idea
> what I am doing wrong? I am adding the elements to be drawn to a wx.Panel,
Use a wx.ScrolledWindow. Doing your own scrolling on other window types
is possible, but is more advanced and complex.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-dev-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-dev-help@lists.wxwidgets.org
Apart from your good tips, I haven't got this to work yet.
Let me describe shortly my situation. I have three classes in my program. They
all are of type wx.Frame. The first wx.Frame object is the parent of the second
wx.Frame, and the second is the parent of the third wx.Frame.
On top of the third wx.Frame I now try to put the wx.ScrolledWindow instead of
the wx.Panel. Everything works fine apart from the scrollbars that don't even
come visible. As I construct the wx.Frame, I so for set the size for them as
big as I can (because I don't know how to scroll). May this destroy my efforts
to scroll? Is it normal to have wx.Frame as parent of wx.ScrolledWindow?
Yes. It's essentially just a wx.Panel that happens to understand virtual size and how to manage scrollbars. All you need to do is figure out how big you want the virtual size of the scrolled window to be, call its SetVirtualSize method, and also SetScrollRate, then whenever the client size is smaller than that virtual size then the scrollbar(s) will appear and be active.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Great! Now scrolling works perfectly! But something else got broken: my
connectors that are drawn within an OnPaint event now draw some extra stuff:
namely, my scroll rate is (20,20), and when there is a connector within that
(20,20) distance from end of a frame, it gets falsely copied after each
scroll.
When scrolling another direction the connectors get flushed away completely. Is
there any way to sync OnPaint with this scrolling to have the whole drawing
updated?
Thanks,
Jarno
Quoting Robin Dunn <robin@alldunn.com>:
···
Jarno Väyrynen wrote:
> Apart from your good tips, I haven't got this to work yet.
>
> Let me describe shortly my situation. I have three classes in my program.
They
> all are of type wx.Frame. The first wx.Frame object is the parent of the
second
> wx.Frame, and the second is the parent of the third wx.Frame.
>
> On top of the third wx.Frame I now try to put the wx.ScrolledWindow instead
of
> the wx.Panel. Everything works fine apart from the scrollbars that don't
even
> come visible. As I construct the wx.Frame, I so for set the size for them
as
> big as I can (because I don't know how to scroll). May this destroy my
efforts
> to scroll? Is it normal to have wx.Frame as parent of wx.ScrolledWindow?
Yes. It's essentially just a wx.Panel that happens to understand
virtual size and how to manage scrollbars. All you need to do is figure
out how big you want the virtual size of the scrolled window to be, call
its SetVirtualSize method, and also SetScrollRate, then whenever the
client size is smaller than that virtual size then the scrollbar(s) will
appear and be active.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-dev-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-dev-help@lists.wxwidgets.org
Great! Now scrolling works perfectly! But something else got broken: my
connectors that are drawn within an OnPaint event now draw some extra stuff:
namely, my scroll rate is (20,20), and when there is a connector within that
(20,20) distance from end of a frame, it gets falsely copied after each
scroll.
When scrolling another direction the connectors get flushed away completely. Is
there any way to sync OnPaint with this scrolling to have the whole drawing
updated?
Are you calling the scrolled window's DoPrepareDC method?
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Oops, I didn't have that called. Now it's working perfectly, I can hardly
believe it! :). Thanks a lot!
Jarno
Quoting Robin Dunn <robin@alldunn.com>:
···
Jarno Väyrynen wrote:
> Great! Now scrolling works perfectly! But something else got broken: my
> connectors that are drawn within an OnPaint event now draw some extra
stuff:
> namely, my scroll rate is (20,20), and when there is a connector within
that
> (20,20) distance from end of a frame, it gets falsely copied after each
> scroll.
>
> When scrolling another direction the connectors get flushed away
completely. Is
> there any way to sync OnPaint with this scrolling to have the whole
drawing
> updated?
Are you calling the scrolled window's DoPrepareDC method?
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-dev-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-dev-help@lists.wxwidgets.org