I want to have scrollbars in a wxpython object that the user cannot navigate away from. Like how a dialog works. I want the scrollable area to be have comboboxes on it. I understand that I can easily put a scrollable area on a dialog that includes text.

The only way I can think to do this is to put the scrollable area on a frame, but the user then can navigate way from it which I do not want.

Can you not have scrollbars on dialogs?

Thanks for any help...I really can't figure this out...

If you roll your own dialog box instead of using the standard offerings you can put anything you'd like on it...

If you roll your own dialog box instead of using the standard offerings you can put anything you'd like on it...

I assume what you mean by that is to create a custom dialog. Something like this:

class MyDialog(wx.Dialog):
    def __init__(self, parent, id, title):
        wx.Dialog.__init__(self, parent, id, title)

The problem is that I do not know what to do now. In a frame, I can do this to get scrollbars:

import wx

class ScrollbarFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, 'Scrollbar Example', size=(300, 200))
        self.scroll = wx.ScrolledWindow(self, -1)
        self.scroll.SetScrollbars(1, 1, 600, 400)
    
app = wx.PySimpleApp()
frame = ScrollbarFrame()
frame.Show()
app.MainLoop()

But, this does not work in a dialog.

How do I do this in a custom dialog?

Thank you very much for your help.

This article has been dead for over six months. Start a new discussion instead.