| 12
 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
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 
 |  
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
 
 
import wx
 
 
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)
 
        # panel_B : Interface Graphique
        panel_B = InterfaceGraphique(conteneur)
 
        panelSizer.Add(panel_B, 0, wx.EXPAND)
 
        conteneur.SetSizer(panelSizer)
        frameSizer.Add(conteneur, 1, wx.EXPAND)
        self.SetSizer(frameSizer)
        frameSizer.SetSizeHints(self)
 
        self.Show(True)
 
#-------------------------------------------------------------------------
class InterfaceGraphique(wx.Panel):
    """Interface_Graphique de la fenêtre principale"""
#-------------------------------------------------------------------------
 
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1)
 
        # Initialise les différents Sizer
        vbox_top = wx.BoxSizer(wx.VERTICAL)
        vbox = wx.BoxSizer(wx.HORIZONTAL)
 
 
#*********************************************************
     # panel2 : Interface Joueur
#*********************************************************
 
     # Create a panel to house everything
        self.panel2 = wx.Panel(self, -1)
 
      # Create vertical box sizer : bordure
        self.bordure2 = wx.BoxSizer(wx.VERTICAL)
 
        # Création du Widget wxStaticBox : Interface joueur avec son Sizer
        self.staticBox2 = wx.StaticBox ( self.panel2, -1, 'Interface Joueur' )
        self.staticBoxSizer2 = wx.StaticBoxSizer(box = self.staticBox2, orient=wx.VERTICAL)
 
        #-------------------------------------------------------------
        # écran "Lancé de dés"
        #-------------------------------------------------------------
        self.boxSizer4 = wx.BoxSizer(orient=wx.VERTICAL)
        # Création du Widget "StaticBox5" 'Lancé de Dés' avec son Sizer
        self.staticBox5 = wx.StaticBox( self.panel2, -1, 'Lance de Des' )
        self.sizer_Dice = wx.StaticBoxSizer(box=self.staticBox5, orient=wx.HORIZONTAL)
        # Création du panel "panel_Dice"
        self.panel_Dice = Interface_Dice(self.panel2, self.sizer_Dice)
        # Configure le StaticBox contenant l'écran : "Lancé de dés"
        self.boxSizer4.Add(self.sizer_Dice, 0, border=0, flag=wx.EXPAND)
        # Ajout au sizer du Panel2
        self.staticBoxSizer2.AddSizer(self.boxSizer4, 0, border=0, flag=wx.EXPAND)
 
        #-------------------------------------------------------------
        # écran "Actions"
        #-------------------------------------------------------------
        self.boxSizer5 = wx.BoxSizer(orient=wx.VERTICAL)
       # Création du Widget "StaticBox" : "Actions" avec son Sizer
        self.staticBox7 = wx.StaticBox( self.panel2, -1, 'Actions')
        self.sizer_Actions = wx.StaticBoxSizer(box=self.staticBox7, orient=wx.VERTICAL)
        # Création du panel "panel_Actions"
        self.panel_Actions = Interface_Actions(self.panel2, self.sizer_Actions)
        # Configure the box sizers
        self.boxSizer5.AddSizer(self.sizer_Actions, 1, border=0 ,flag=wx.EXPAND | wx.ALL)
        # Ajout au sizer du Panel2
        self.staticBoxSizer2.AddSizer(self.boxSizer5, 0, border=0, flag=wx.EXPAND)
 
 
      #-----------------------------------------------------------
      # Configure the box sizers du Panel2
        self.bordure2.Add(self.staticBoxSizer2, 1, wx.EXPAND | wx.ALL, 5)
 
      # Attach everything
        self.panel2.SetSizerAndFit (self.bordure2)
        vbox.Add(self.panel2, 1, wx.EXPAND)
 
 
#*********************************************************
#       Rendu final du sizer
        vbox_top.Add(vbox, 1, wx.EXPAND)
        self.SetSizer(vbox_top)
#*********************************************************
 
 
 
#-------------------------------------------------------------------------
class Interface_Dice(wx.Panel):
    """Création de l'interface "Panel_Dice"""
#-------------------------------------------------------------------------
 
    def __init__(self, parent, Sizer_Conteneur):
 
        wx.Panel.__init__(self, parent, -1)
 
        # Initialisation
        self.parent = parent
        self.conteneur = Sizer_Conteneur
 
        # Création du panel "panel_Roll" et Liaison du panel avec le sizer "conteneur"
        self.panel_Dice = wx.Panel(parent, -1)
        self.conteneur.Add(self.panel_Dice, 1, border=0, flag= wx.EXPAND)
 
        # Création des Widgets "Lancé de Dés" contenu dans le panel_Roll
        self.buttonDice = wx.Button(id=20001, parent=self.panel_Dice, label='Des')
        self.buttonDice.Enable(False)
 
        # Création du Sizer dans le Widget
        self.gridBagSizer1 = wx.GridBagSizer(0,0)
 
        # Ajout des Widgets dans le Sizer
        self.gridBagSizer1.Add(self.buttonDice, (4, 4), flag=wx.EXPAND | wx.ALL, span=(1, 2), border=5)
 
 
        # Configuration du Sizer
        self.panel_Dice.SetSizerAndFit(self.gridBagSizer1)
 
        # Evenements
        self.buttonDice.Bind(wx.EVT_BUTTON, self.OnRollButton, id=20001)
 
 
    #*********************************************************
    #       Méthodes du panel: "Lancé de dés"
 
    def Initialise_interface_Dice(self):
        self.buttonDice.Enable(True)
 
 
    def OnRollButton(self, event):
        wx.MessageBox(u"Coucou, je suis dans la Methode : OnRollButton(self, event) ^-^   ", "OnRollButton(self, event)")
        event.Skip()
 
#-------------------------------------------------------------------------
class Interface_Actions(wx.Panel):
    """Création de l'interface "Panel_Actions"""
#-------------------------------------------------------------------------
 
    def __init__(self, parent, Sizer_Conteneur):
 
        wx.Panel.__init__(self, parent, -1)
 
        # Initialisation
        self.parent = parent
        self.conteneur = Sizer_Conteneur
 
        # Création du panel "panel_Roll" et Liaison du panel avec le sizer "conteneur"
        self.panel_Actions = wx.Panel(self.parent, -1)
        self.conteneur.Add(self.panel_Actions, 1, border=0, flag= wx.EXPAND)
 
        # Création des Boutons
        self.button1 = wx.Button(id=2010, label='Action', parent=self.panel_Actions)
 
        # Création des Sizers des boutons
        self.vBoxSizer_button = wx.BoxSizer(orient=wx.HORIZONTAL)
 
        # Ajout des boutons dans les Sizers respectifs
        self.vBoxSizer_button .Add(self.button1, 1, border=-1, flag=wx.ALIGN_CENTER | wx.ALIGN_LEFT)
 
      # Configure the box sizers
        self.panel_Actions.SetSizer(self.vBoxSizer_button)
 
        # Evenements
        self.button1.Bind(wx.EVT_BUTTON, self.OnButtonEssai, id=2010)
 
 
#*********************************************************
#       Méthodes du panel: "Actions"
 
    def OnButtonEssai(self, event):
#        wx.MessageBox(u"Coucou, je suis dans la Methode : OnButtonEssai(self, event) ^-^   ", "OnButtonEssai(self, event)")
        Interface_Dice.Initialise_interface_Dice()
 
 
app = wx.App()
SimpleFrame(None, -1, u'Ma Belle Fenetre')
app.MainLoop() | 
Partager