__blackjack__ hat geschrieben: ↑Dienstag 5. Januar 2021, 17:35
Du suchst `wx.lib.scrolledpanel.ScrolledPanel`‽
Beim googeln bin ich natürlich auch auf wx.lib.scrolledpanel.ScrolledPanel gestoßen.
Das Thema ist mir aber zu kompliziert.
Der erste Google-Treffer verweist mir auf
https://wxpython.org/Phoenix/docs/html/ ... panel.html
Und dort ist auch ein Beispiel-Code hinterlegt:
Code: Alles auswählen
text = '''
ScrolledPanel extends wx.ScrolledWindow, adding all
the necessary bits to set up scroll handling for you.
Here are three fixed size examples of its use. The
demo panel for this sample is also using it -- the
wx.StaticLine below is intentionally made too long so a scrollbar will be
activated.'''
import wx
import wx.lib.scrolledpanel as scrolled
class TestPanel(scrolled.ScrolledPanel):
def __init__(self, parent):
scrolled.ScrolledPanel.__init__(self, parent, -1)
vbox = wx.BoxSizer(wx.VERTICAL)
desc = wx.StaticText(self, -1, text)
desc.SetForegroundColour("Blue")
vbox.Add(desc, 0, wx.ALIGN_LEFT | wx.ALL, 5)
vbox.Add(wx.StaticLine(self, -1, size=(1024, -1)), 0, wx.ALL, 5)
vbox.Add((20, 20))
self.SetSizer(vbox)
self.SetupScrolling()
app = wx.App(0)
frame = wx.Frame(None, wx.ID_ANY)
fa = TestPanel(frame)
frame.Show()
app.MainLoop()
Wegen einer Scrollbar so ein umfangreiches Klassen-Konstrukt?
Das kann doch eigentlich nicht sein.