IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

wxPython Discussion :

Problème Dialog Mise en forme


Sujet :

wxPython

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    75
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2007
    Messages : 75
    Points : 61
    Points
    61
    Par défaut Problème Dialog Mise en forme
    Bonjour à tous,

    Je n'arrive pas à disposer correctement les éléments dans ma vue.

    Je souhaite faire une fenêtre dialog comme la vue ci-dessous:

    Nom : vue.png
Affichages : 135
Taille : 9,2 Ko

    Pour l'instant j'ai ceci:

    Nom : vue2.png
Affichages : 123
Taille : 14,2 Ko

    Et voici 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
    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
    class FormDialog(sc.SizedDialog):
        def __init__(self, parent, id):
            sc.SizedDialog.__init__(self, None, -1, "Configuration FTP Home",
                            style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,size=wx.Size(600, 400))
            cPane = self.GetContentsPane()
            pane = sc.SizedScrolledPanel(cPane, wx.ID_ANY)
            pane.SetSizerProps(expand=True, proportion=1)
            pane.SetSizerType("form")
     
            wx.StaticText(pane, -1, "Recuperation fichiers")
            radioPane = sc.SizedPanel(pane, -1)
            radioPane.SetSizerType("horizontal")
            radioPane.SetSizerProps(expand=True)
     
            # make these children of the radioPane to have them use
            # the horizontal layout
            self.button_ftp= wx.RadioButton(radioPane, -1, "FTP")
            button_file=wx.RadioButton(radioPane, -1, "Fichier.")
     
            self.button_ftp.Bind(wx.EVT_RADIOBUTTON, self.EvtRadioBox)
            button_file.Bind(wx.EVT_RADIOBUTTON, self.EvtRadioBox)
            #self.Bind(wx.EVT_RADIOBUTTON, self.EvtRadioBox, wx.RadioBu tton)
            #pane.Bind(wx.EVT_RADIOBUTTON,button_ftp,self.EvtRadioBox)
            #pane.Bind(wx.EVT_RADIOBUTTON, self.EvtRadioBox, id=button_ftp.GetId())
            #self.Bind(wx.EVT_RADIOBUTTON,button_ftp,self.EvtRadioBox)
     
     
            self.buttonDir = wx.Button(pane, 20, "Browse Folder!", (20, 25))
            self.Bind(wx.EVT_BUTTON, self.opendir, self.buttonDir)
     
     
     
     
            wx.StaticText(pane, -1, "Adresse")
            textCtrl = wx.TextCtrl(pane, -1, "")
            textCtrl.SetSizerProps(expand=True)
     
            #wx.StaticText(pane, -1, "Port")
            textCtrl = wx.TextCtrl(pane, -1, "",name="Port:")#,validator = MyValidator(DIGIT_ONLY))
            textCtrl.SetSizerProps(expand=True)
     
            wx.StaticText(pane, -1, "Utilisateur")
            textCtrl = wx.TextCtrl(pane, -1, "")
            textCtrl.SetSizerProps(expand=True)
     
            wx.StaticText(pane, -1, "Mot de passe")
            textCtrl = wx.TextCtrl(pane, -1, "",style=wx.TE_PASSWORD)
            textCtrl.SetSizerProps(expand=True)
     
     
            # The dialog is not in the screen anymore, but it's still in memory
            #for you to access it's values. remove it from there.
            #dd.Destroy()
     
            self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))
     
        def opendir(self, event):
            dlg = wx.DirDialog(self, "Choose a directory:", style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON)
            if dlg.ShowModal() == wx.ID_OK:
                self.SetStatusText('You selected: %s\n' % dlg.GetPath())
            dlg.Destroy()
     
        def EvtRadioBox(self, event):
            baudRate1 = str(self.button_ftp.GetValue())
            print 'EvtRadioBox:',baudRate1
            if self.button_ftp.GetValue():
                self.buttonDir.Hide()
            else:
                self.buttonDir.Show()
            #print 'baudRate1: %d\n' % event.GetInt()
            return True
     
        def OnCloseWindow(self, event):
            self.Destroy()
            exit()
        def OnClick(self, event):
             dlg = BrowseFolder(self)
             dlg.Destroy()
    Je sais que mon code n'est pas correct. Par contre je n'arrive pas à comprendre comme fonctionne la disposition des éléments avec wxpython. Avez-vous un bon tuto ?

    Je souhaite également que lorsqu'on sélectionne fichier, les informations concernant la connexion ftp ne soient plus visible et qu'un bouton pour sélectionner le dossier soit visible.

    D'avance merci pour votre aide.

    Ce que je souhaite avant tout c'est m'aider à comprendre comment fonctionne la disposition.

  2. #2
    Membre actif
    Profil pro
    Inscrit en
    Septembre 2007
    Messages
    328
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2007
    Messages : 328
    Points : 240
    Points
    240
    Par défaut
    Bonjour,

    Tu dois utiliser un Gridsizer. Pour commencer, l'idéal est d'utiliser wxGlade pour observer le code généré automatiquement.

    A +

Discussions similaires

  1. Réponses: 7
    Dernier message: 13/08/2009, 20h20
  2. [CR9] [CRXI] Problème de mise en forme sur un nom de groupe
    Par Maltus dans le forum SAP Crystal Reports
    Réponses: 1
    Dernier message: 06/09/2006, 10h32
  3. [VBA_E] Problème de mise ne forme,pour balayage
    Par baptbapt dans le forum Macros et VBA Excel
    Réponses: 8
    Dernier message: 29/08/2006, 13h33
  4. [VBA] Problème enregistrement mise en forme fichier word
    Par guenfood dans le forum VBA Word
    Réponses: 1
    Dernier message: 07/06/2006, 14h10

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo