wxPython - Beispiel: wxSplitterwindow

Code-Stücke können hier veröffentlicht werden.
Antworten
2bock
User
Beiträge: 94
Registriert: Freitag 12. September 2003, 07:58
Wohnort: 50.9333300 / 6.3666700

Montag 5. Juli 2004, 13:21

Hier ein kleines Beispiel für einen wxSplitterWindow.

Viel Spaß damit.

Greetz from 2bock

Code: Alles auswählen

import  wx

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

class MySplitter(wx.SplitterWindow):
    def __init__(self, parent, ID):
        wx.SplitterWindow.__init__(self, parent, ID,wx.Point (10,10))
                                   #~ | wx.SP_LIVE_UPDATE
                                   #~ )

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

def runTest(frame, nb):
    splitter = MySplitter(frame, -1)

    p1 = wx.Window(splitter, -1)
    p1.SetBackgroundColour(wx.RED)
    wx.StaticText(p1, -1, "Panel One", (5,5))#.SetBackgroundColour(wx.RED)

    p2 = wx.Window(splitter, -1)
    p2.SetBackgroundColour(wx.BLUE)
    p2.SetForegroundColour(wx.WHITE)
    wx.StaticText(p2, -1, "Panel Two", (5,5))#.SetBackgroundColour(wx.BLUE)

    splitter.SetMinimumPaneSize(20)
    splitter.SplitVertically(p1, p2, -100)

    return splitter
    
    splitter2 = MySplitter(frame, -1)
    
    p3 = wx.Window(splitter, -1)
    p3.SetBackgroundColour(wx.GREEN)
    wx.StaticText(p3, -1, "Panel One", (5,5))#.SetBackgroundColour(wx.RED)

    p4 = wx.Window(splitter, -1)
    p4.SetBackgroundColour(wx.BLACK)
    p4.SetForegroundColour(wx.GREY)
    wx.StaticText(p4, -1, "Panel Two", (5,5))#.SetBackgroundColour(wx.BLUE)

    splitter2.SetMinimumPaneSize(20)
    splitter2.SplitHorizontally(p3, p4, -100)

    return splitter2
    
    
    
    
if __name__ == '__main__':
    from sys import argv
    app = wx.PySimpleApp()
    frm = wx.Frame(None, -1, 'Ein Name')
    pnl = runTest(frm, -1)
    frm.Show()
    
    app.MainLoop()
:wink: :wink: :roll:
Antworten