Bonjour,
J'ai besoin d'un petit coup de main sur ce coup là, je fais donc appel à vos compétences.
Y aurait-il quelqu'un dans l'assistance qui pourrait m'expliquer pourquoi ma barre d'outils et mon Panel vert ne remplissent pas la totalité de ma fenêtre grise ?
Enfin, jetez un oeil sur le code, je pense que vous comprendrez mieux qu'une tonne d'explications confuses.
Merci de votre réponse
Module 01
Module 02
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50 #!/usr/bin/env python # -*- coding: cp1252 -*- # Tempo_01.py import wx import Tempo_02 class SimpleFrame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title) frameSizer = wx.BoxSizer(wx.VERTICAL) panelSizer = wx.BoxSizer(wx.VERTICAL) conteneur = wx.Panel(self, -1) conteneur.SetBackgroundColour('#80f14e') #********************************************************* # panel_A : Barre d'outils panel_A = Tempo_02.Barre_Outils_01(conteneur) #********************************************************* # panel_B : Interface Graphique panel_B = Tempo_02.Interface_Graphique_01(conteneur) panelSizer.Add(panel_A, 2, wx.EXPAND) panelSizer.Add(panel_B, 2, wx.EXPAND) conteneur.SetSizer(panelSizer) frameSizer.Add(conteneur, 1, wx.EXPAND) self.SetSizer(frameSizer) frameSizer.SetSizeHints(self) self.SetSize((500,500)) self.Centre() self.Show(True) app = wx.App() SimpleFrame(None, -1, 'Ma Belle Fenêtre') app.MainLoop()
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59 #!/usr/bin/env python # -*- coding: cp1252 -*- # Tempo_02.py import wx #------------------------------------------------------------------------- class Barre_Outils_01(wx.Panel): """Barre d'outils de la fenêtre principale""" #------------------------------------------------------------------------- def __init__(self, parent): wx.Panel.__init__(self, parent) TBFLAGS = ( wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT ) tb = wx.ToolBar(self, style=TBFLAGS) # self sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(tb, 0, wx.EXPAND) self.SetSizer(sizer) tsize = (24,24) # Définition des différents icones de la barre d'outils Png_01 = wx.Bitmap("exit.png") Png_02 = wx.Bitmap("book.png") Png_03 = wx.Bitmap("linux.png") tb.SetToolBitmapSize(tsize) # Dessine la Barre d'outils tb.AddLabelTool(10, "", Png_01) tb.AddSeparator() tb.AddLabelTool(20, "", Png_02) tb.AddSeparator() tb.AddLabelTool(30, "", Png_03) tb.AddSeparator() tb.Realize() #------------------------------------------------------------------------- class Interface_Graphique_01(wx.Panel): """Interface_Graphique de la fenêtre principale""" #------------------------------------------------------------------------- def __init__(self, parent): wx.Panel.__init__(self, parent, -1) panel = wx.Panel(self, -1) panel.SetBackgroundColour('#4f5049') sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(panel, 1, wx.EXPAND) self.SetSizer(sizer)
Partager