Seite 1 von 1

Probleme mit StaticBox und ScrolledPanel

Verfasst: Samstag 8. September 2007, 09:13
von Stolzi
Hi,

irgendwie will das folgende Bsp nicht. Wenn ich Scrolle kommen die StaticBoxen völlig durcheinander. Wenn man das ganze Fenster aber auf volle Größe des Panels aufzieht, dann passts.
Vertragen sich StaticBoxen nicht mit ScrolledPanel, oder habe ich da was falsch gemacht?

Danke für die Hilfe
Stolzi

Code: Alles auswählen




import  wx
import  wx.lib.scrolledpanel as scrolled
#----------------------------------------------------------------------------

#----------------------------------------------------------------------------

class MyFrame(wx.Frame):
    def __init__(
            self, parent, ID, title, log, pos=wx.DefaultPosition,
            size=(500,500), style=wx.DEFAULT_FRAME_STYLE
            ):
        self.log=log
        wx.Frame.__init__(self, parent, ID, title, pos, size, style)
        #panel = wx.Panel(self, -1)
        panel = scrolled.ScrolledPanel(self, -1,style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
        texts=[]
        texts2=[]
        texts3=[]
        for i in range(30):
            texts.append(wx.StaticText(panel, -1, unicode("Der Text")))
        for i in range(30):
            texts2.append(wx.StaticText(panel, -1, unicode("Der Text")))
        for i in range(30):
            texts3.append(wx.StaticText(panel, -1, unicode("Der Text")))
        
        
        box1 = wx.StaticBox(panel, -1, "This is a wx.StaticBox")
        bsizer1 = wx.StaticBoxSizer(box1, wx.VERTICAL)
        gridsizer1 = wx.FlexGridSizer(cols=3, hgap=5, vgap=5)
        gridsizer1.AddMany(texts)
        bsizer1.Add(gridsizer1, 0, wx.ALL, 10)
        
        box2 = wx.StaticBox(panel, -1, "This is a wx.StaticBox")
        bsizer2 = wx.StaticBoxSizer(box2, wx.VERTICAL)
        gridsizer2 = wx.FlexGridSizer(cols=3, hgap=5, vgap=5)
        gridsizer2.AddMany(texts2)
        bsizer2.Add(gridsizer2, 0, wx.ALL, 10)
        
        box3 = wx.StaticBox(panel, -1, "This is a wx.StaticBox")
        bsizer3 = wx.StaticBoxSizer(box3, wx.VERTICAL)
        gridsizer3 = wx.FlexGridSizer(cols=3, hgap=5, vgap=5)
        gridsizer3.AddMany(texts3)
        bsizer3.Add(gridsizer3, 0, wx.ALL, 10)
        
        border = wx.BoxSizer(wx.VERTICAL)
        border.Add(bsizer1, 0, wx.ALL, 25)
        border.Add(bsizer2, 0, wx.ALL, 25)
        border.Add(bsizer3, 0, wx.ALL, 25)
        panel.SetSizer(border)
        panel.SetAutoLayout(1)
        panel.SetupScrolling()
        
        borderb = wx.BoxSizer()
        borderb.Add(panel, 1, wx.EXPAND|wx.ALL, 25)
        self.SetSizer(borderb)
        

if __name__ == '__main__':
    import sys
    app = wx.PySimpleApp()
    frame = MyFrame(None, wx.ID_ANY, 'Frame', sys.stdout)
    frame.Show(True)
    app.MainLoop()

Verfasst: Samstag 8. September 2007, 11:02
von Stolzi
Ich glaube ich habe die Antwort auf meine Frage:
http://www.nabble.com/--wxwindows-Bugs- ... 83899.html