Ram Rachum
Ram Rachum

Reputation: 88578

wxPython: Making a scrollable DC

I am drawing inside a wx.Window using a PaintDC. I am drawing circles and stuff like that into that window. Problem is, sometimes the circles go outside the scope of the window. I want a scrollbar to automatically appear whenever the drawing gets too big. What do I do?

Upvotes: 1

Views: 1435

Answers (1)

RSabet
RSabet

Reputation: 6160

Use a wx.ScrolledWindow and set the size of the window as soon as your 'drawing go outside' the window with

SetVirtualSize(width,height)

If this size is bigger than the client size, then wx will show scrollbars. When drawing in the window make sure to use CalcUnscrolledPosition and CalcScrolledPosition

Here you can find some more information.

Upvotes: 1

Related Questions