Bonjour,

me voilà encore j'ai un problème que je viens de créer des nouveau panel deux panels ( bottom and top ) , j'aimerai ajouter une autre à gauche j'ai essayé avec class leftPanel mais s'ajoute pas :

voilà mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import wx
 
class MainFrame(wx.Frame):
    def __init__(self,parent):
        wx.Frame.__init__(self,parent,title="myapp",size=(800,580))
        self.split_win =wx.SplitterWindow(self)
        self.top = wx.Panel(self.split_win ,style = wx.SUNKEN_BORDER)
        self.bottom = wx.Panel(self.split_win ,style = wx.SUNKEN_BORDER)
        self.split_win.SplitHorizontally(self.top,self.bottom,450)
        st1 = wx.StaticText(self.bottom, -1, "This is an example of static text", (20, 10))
        self.bottom.SetBackgroundColour('white')
#ajouter text control et les widget et control
        font =wx.Font(10,wx.SWISS,wx.NORMAL,wx.NORMAL)
        st1.SetFont(font)
class LeftPanel(wx.Panel):
    def __init__(self,parent):
        super().__init__(parent, size=(500, 100))
        #self.SetBackgroundColour("green")
        leftpanel = wx.Panel(self, -1, size = (200, 1000),style = wx.BORDER_SUNKEN)
        leftpanel.SetBackgroundColour(wx.LIGHT_GREY)
        LeftPanel = LeftPanel(self)
        topSizer.Add(LeftPanel)
 
app = wx.App()
frame=MainFrame(None).Show()
app.MainLoop()



j'ai un bon exemple mais avec wx.aui avec un bouton de fermeture mais j'aimerai pas avoir ces button de fermeture juste les panels avec split window :



Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import wx
import wx.aui
 
class MyFrame(wx.Frame):
    def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, *args, **kwargs)
 
        self.mgr = wx.aui.AuiManager(self)
 
        leftpanel = wx.Panel(self, -1, size = (200, 150))
        leftpanel.SetBackgroundColour("white")
        rightpanel = wx.Panel(self, -1, size = (200, 150))
        bottompanel = wx.Panel(self, -1, size = (200, 150))
        st1 = wx.StaticText(leftpanel, -1, "This is an example of static text", (20, 10))        
        self.mgr.AddPane(leftpanel, wx.aui.AuiPaneInfo().Bottom())
        self.mgr.AddPane(rightpanel, wx.aui.AuiPaneInfo().Left().Layer(1))
        self.mgr.AddPane(bottompanel, wx.aui.AuiPaneInfo().Center().Layer(2))
 
        self.mgr.Update()
 
 
class MyApp(wx.App):
    def OnInit(self):
        frame = MyFrame(None, -1, '07_wxaui.py')
        frame.Show()
        self.SetTopWindow(frame)
        return 1
 
if __name__ == "__main__":
    app = MyApp(0)
    app.MainLoop()

est ce que je peux avoir la panel a gauche son mettre classe leftpanel comme l'exemple ou non ?

merci d'avance