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

Tkinter Python Discussion :

2 frames l'une au dessous de l'autre


Sujet :

Tkinter Python

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éprouvé
    Profil pro
    Inscrit en
    Février 2003
    Messages
    926
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2003
    Messages : 926
    Par défaut 2 frames l'une au dessous de l'autre
    Bonjour,

    dans le code ci-dessous, je souhaiterai faire disparaitre les bandes noires du canvas qui séparent les deux frames pour les accoler l'une en dessous de l'autre. Pourriez-vous m'aider svp?

    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
    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
    from tkinter import *
    from tkinter import ttk
     
    class VerticalScrolledFrame(Frame):
        """A pure Tkinter scrollable frame that actually works!
        * Use the 'interior' attribute to place widgets inside the scrollable frame
        * Construct and pack/place/grid normally
        * This frame only allows vertical scrolling
        """
        def __init__(self, parent, *args, **kw):
            Frame.__init__(self, parent, *args, **kw)        
     
            # create a canvas object and a vertical scrollbar for scrolling it
            vscrollbar = Scrollbar(self, orient=VERTICAL)
            vscrollbar.pack(fill=Y, side=RIGHT, expand=FALSE)
            canvas = Canvas(self, bd=0, highlightthickness=0, bg="black", yscrollcommand=vscrollbar.set)
            canvas.pack(side=LEFT, fill=BOTH, expand=TRUE)
            vscrollbar.config(command=canvas.yview)
     
            # reset the view
            canvas.xview_moveto(0)
            canvas.yview_moveto(0)
     
            # create a frame inside the canvas which will be scrolled with it
            self.interior = interior = Frame(canvas, bg="beige")
            interior_id = canvas.create_window(0, 0, window=interior, anchor=NW)
     
            # track changes to the canvas and frame width and sync them,
            # also updating the scrollbar
            def _configure_interior(event):
                # update the scrollbars to match the size of the inner frame
                size = (interior.winfo_reqwidth(), interior.winfo_reqheight())
                canvas.config(scrollregion="0 0 %s %s" % size)
                if interior.winfo_reqwidth() != canvas.winfo_width():
                    # update the canvas's width to fit the inner frame
                    canvas.config(width=interior.winfo_reqwidth())
            interior.bind('<Configure>', _configure_interior)
     
            def _configure_canvas(event):
                if interior.winfo_reqwidth() != canvas.winfo_width():
                    # update the inner frame's width to fill the canvas
                    canvas.itemconfigure(interior_id, width=canvas.winfo_width())
            canvas.bind('<Configure>', _configure_canvas)
     
    def create_frame1(master, t):
     
        L = root.winfo_screenwidth()
        H = root.winfo_screenheight()
     
        frame = Frame(master, bd=12, bg="beige", padx=50)#, relief=SUNKEN)
     
        t = "mon lab"
     
        monText = Text(frame)
        newBtn = Button(toolbar, text="Tableau", bg="maroon", fg="white", borderwidth=3, command=para1)
        newBtn.pack(side=LEFT, fill=X)
     
        root.geometry("%dx%d%+d%+d" % (L,H,0,0))    
        root.update_idletasks()
        print(root.winfo_width())
        print("ok")
        print(frame.winfo_width())
     
        return frame 
     
    def ChangeColor():
     
        newBtn3.configure(bg='red')
     
     
    if __name__ == '__main__':
     
        class para1(Tk):
     
            def __init__(self, *args, **kwargs):
                for w in frame1.winfo_children():
                        w.destroy()  
                self.frame = VerticalScrolledFrame(frame1)
                self.frame.pack(fill=BOTH, expand=TRUE)
                text = Text(self.frame.interior)#, yscrollcommand=yscrollbar.set)
                text.tag_configure('color', underline="1", borderwidth=12, background='orange', font=('Tempus Sans ITC', 12, 'bold'))
                text.pack(fill=Y)
                t="jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj"
                text.insert(0.0, t)
                root.update()
     
                para2(Tk)
     
        class para2(Tk):
     
            def __init__(self, *args, **kwargs):
                self.frame = VerticalScrolledFrame(frame1)
                self.frame.pack(fill=BOTH, expand=TRUE)            
                text = Text(self.frame.interior)#, yscrollcommand=yscrollbar.set)
                text.tag_configure('color', underline="1", borderwidth=12, background='orange', font=('Tempus Sans ITC', 12, 'bold'))
                text.pack(fill=Y)
                t="kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"
                text.insert(0.0, t)
                root.update()
     
        root = Tk()    
        color= "lightyellow"
     
        root.title("Syntax Analyser")
        myWidth = 25 #largeur des boutons du menu
        myHeight = 25  #hauteur des boutons du menu
     
        myColor="lightblue"
     
        toolbar = Frame(root, borderwidth=2, relief='raised', background=myColor)
        toolbar.pack(side=TOP, fill=X) 
        nb = ttk.Notebook(root)          
     
        # Defines and places the notebook widget
     
        root.update()
     
        numero=1
        frame1 = create_frame1(nb, numero)
        nb.add(frame1, text='Texte')    
     
        ttk.Style().configure(root, background=color)
        nb.pack(fill=BOTH, expand=1)
     
        L = root.winfo_screenwidth()
        H = root.winfo_screenheight() 
        #root.geometry('{}x{}'.format(L, H))
        root.geometry("%dx%d%+d%+d" % (L,H,0,0))
     
        root.configure(background="green")
        root.mainloop()

  2. #2
    Expert éminent
    Homme Profil pro
    Architecte technique retraité
    Inscrit en
    Juin 2008
    Messages
    21 752
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Architecte technique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2008
    Messages : 21 752
    Par défaut
    Salut,

    Citation Envoyé par Arsene12 Voir le message
    Pourriez-vous m'aider svp?
    Pourquoi poster 130 lignes de code pour un problème que vous pourriez reproduire en une dizaine de lignes? (et ce faisant arriver peut être à le corriger tout seul...).

    - W
    Architectures post-modernes.
    Python sur DVP c'est aussi des FAQs, des cours et tutoriels

  3. #3
    Membre éprouvé
    Profil pro
    Inscrit en
    Février 2003
    Messages
    926
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2003
    Messages : 926
    Par défaut
    Citation Envoyé par wiztricks Voir le message
    Salut,
    Pourquoi poster 130 lignes de code pour un problème que vous pourriez reproduire en une dizaine de lignes? (et ce faisant arriver peut être à le corriger tout seul...).
    - W
    Ce n'est qu'une partie du code que je vous ai communiquer ici. Mon programme ne fait pas 130 lignes, il en fait un peu plus de 1000!

  4. #4
    Expert confirmé

    Homme Profil pro
    Inscrit en
    Octobre 2008
    Messages
    4 307
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2008
    Messages : 4 307
    Par défaut
    Salut,

    J'ai testé ton code et je ne vois pas le problème.
    Ce que tu appelles les frames ce sont les deux éditeurs de texte ?
    Ils sont simplement séparés par la bordure créée par défaut pour ce widget, qui est petite et ne gêne en rien.
    Mais ce widget a peut-être un attribut border dans sa configuration qui te permettrait éventuellement de la réduire ou de la supprimer.

  5. #5
    Membre éprouvé
    Profil pro
    Inscrit en
    Février 2003
    Messages
    926
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2003
    Messages : 926
    Par défaut
    Citation Envoyé par VinsS Voir le message
    Salut,
    J'ai testé ton code et je ne vois pas le problème.
    Ce que tu appelles les frames ce sont les deux éditeurs de texte ?
    Ils sont simplement séparés par la bordure créée par défaut pour ce widget, qui est petite et ne gêne en rien.
    Mais ce widget a peut-être un attribut border dans sa configuration qui te permettrait éventuellement de la réduire ou de la supprimer.
    Merci pour cette suggestion. J'ai mis les border à 0 mais le problème ne venait pas de là. Il venait de la ligne avec le expand=1:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    nb.pack(fill=BOTH, expand=1)
    que j'ai remplacé par :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    nb.pack(fill=BOTH, expand=0)
    Maintenant, lorsqu'on clique sur le bouton Tableau, ça marche !

    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
    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
    from tkinter import *
    from tkinter import ttk
     
    class VerticalScrolledFrame(Frame):
        """A pure Tkinter scrollable frame that actually works!
        * Use the 'interior' attribute to place widgets inside the scrollable frame
        * Construct and pack/place/grid normally
        * This frame only allows vertical scrolling
        """
        def __init__(self, parent, *args, **kw):
            Frame.__init__(self, parent, *args, **kw)        
     
            # create a canvas object and a vertical scrollbar for scrolling it
            vscrollbar = Scrollbar(self, orient=VERTICAL)
            vscrollbar.pack(fill=Y, side=RIGHT, expand=FALSE)
            canvas = Canvas(self, bd=0, highlightthickness=0, bg="black", yscrollcommand=vscrollbar.set)
            canvas.pack(side=LEFT, fill=BOTH, expand=TRUE)
            vscrollbar.config(command=canvas.yview)
     
            # reset the view
            canvas.xview_moveto(0)
            canvas.yview_moveto(0)
     
            # create a frame inside the canvas which will be scrolled with it
            self.interior = interior = Frame(canvas, bg="beige")
            interior_id = canvas.create_window(0, 0, window=interior, anchor=NW)
     
            # track changes to the canvas and frame width and sync them,
            # also updating the scrollbar
            def _configure_interior(event):
                # update the scrollbars to match the size of the inner frame
                size = (interior.winfo_reqwidth(), interior.winfo_reqheight())
                canvas.config(scrollregion="0 0 %s %s" % size)
                if interior.winfo_reqwidth() != canvas.winfo_width():
                    # update the canvas's width to fit the inner frame
                    canvas.config(width=interior.winfo_reqwidth())
            interior.bind('<Configure>', _configure_interior)
     
            def _configure_canvas(event):
                if interior.winfo_reqwidth() != canvas.winfo_width():
                    # update the inner frame's width to fill the canvas
                    canvas.itemconfigure(interior_id, width=canvas.winfo_width())
            canvas.bind('<Configure>', _configure_canvas)
     
    def create_frame1(master, t):
     
        L = root.winfo_screenwidth()
        H = root.winfo_screenheight()
     
        frame = Frame(master, bd=0, bg="beige", padx=50)#, relief=SUNKEN)
     
        t = "mon lab"
     
        monText = Text(frame)
        newBtn = Button(toolbar, text="Tableau", bg="maroon", fg="white", borderwidth=3, command=para1)
        newBtn.pack(side=LEFT, fill=X)
     
        root.geometry("%dx%d%+d%+d" % (L,H,0,0))    
        root.update_idletasks()
        print(root.winfo_width())
        print("ok")
        print(frame.winfo_width())
     
        return frame 
     
    def ChangeColor():
     
        newBtn3.configure(bg='red')
     
     
    if __name__ == '__main__':
     
        class para1(Tk):
     
            def __init__(self, *args, **kwargs):
                for w in frame1.winfo_children():
                        w.destroy()  
                self.frame = VerticalScrolledFrame(frame1)
                self.frame.pack(fill=BOTH, expand=TRUE)
                text = Text(self.frame.interior)#, yscrollcommand=yscrollbar.set)
                text.tag_configure('color', underline="1", borderwidth=0, background='orange', font=('Tempus Sans ITC', 12, 'bold'))
                text.pack(fill=Y)
                t="jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj"
                text.insert(0.0, t)
                root.update()
     
                para2(Tk)
     
        class para2(Tk):
     
            def __init__(self, *args, **kwargs):
                self.frame = VerticalScrolledFrame(frame1)
                self.frame.pack(fill=BOTH, expand=TRUE)            
                text = Text(self.frame.interior)#, yscrollcommand=yscrollbar.set)
                text.tag_configure('color', underline="1", borderwidth=0, background='orange', font=('Tempus Sans ITC', 12, 'bold'))
                text.pack(fill=Y)
                t="kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"
                text.insert(0.0, t)
                root.update()
     
        root = Tk()    
        color= "lightyellow"
     
        root.title("Syntax Analyser")
     
        myColor="lightblue"
     
        toolbar = Frame(root, borderwidth=0, relief='raised', background=myColor)
        toolbar.pack(side=TOP, fill=X) 
        nb = ttk.Notebook(root)          
     
        # Defines and places the notebook widget
     
        root.update()
     
        numero=1
        frame1 = create_frame1(nb, numero)
        nb.add(frame1, text='Texte')    
     
        ttk.Style().configure(root, background=color)
        nb.pack(fill=BOTH, expand=0)
     
        L = root.winfo_screenwidth()
        H = root.winfo_screenheight() 
        #root.geometry('{}x{}'.format(L, H))
        root.geometry("%dx%d%+d%+d" % (L,H,0,0))
     
        root.title("Close Test") 
     
        root.configure(background="green")
        root.mainloop()

  6. #6
    Membre éprouvé
    Profil pro
    Inscrit en
    Février 2003
    Messages
    926
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2003
    Messages : 926
    Par défaut
    Y'a une dernière chose qui me reste à régler. C'est la hauteur des frames. Je vois pas ce qui la détermine et comment éviter que la scrollbar s'affiche alors qu'elle est inutile vu que le texte est trop court.

  7. #7
    Expert éminent
    Homme Profil pro
    Architecte technique retraité
    Inscrit en
    Juin 2008
    Messages
    21 752
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Architecte technique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2008
    Messages : 21 752
    Par défaut
    Citation Envoyé par Arsene12 Voir le message
    Ce n'est qu'une partie du code que je vous ai communiquer ici. Mon programme ne fait pas 130 lignes, il en fait un peu plus de 1000!
    Vous voyez que tous ceux qui regardent votre code trouveront un soucis avec le bord du widget Text qui se corrige avec un borderwidth=0 alors qu’apparemment votre soucis était ailleurs.
    Pour résumer la description de votre soucis n'est pas suffisamment précise pour qu'on sache de quoi vous parlez, donc on peut jouer à lancer le programme ou le lire et y trouver de nombreux problèmes qui n'en sont pas (enfin pour vous): on perd juste son temps et çà ne vous aide pas.

    - W
    Architectures post-modernes.
    Python sur DVP c'est aussi des FAQs, des cours et tutoriels

  8. #8
    Membre éprouvé
    Profil pro
    Inscrit en
    Février 2003
    Messages
    926
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2003
    Messages : 926
    Par défaut
    Citation Envoyé par wiztricks Voir le message
    Vous voyez que tous ceux qui regardent votre code trouveront un soucis avec le bord du widget Text qui se corrige avec un borderwidth=0 alors qu’apparemment votre soucis était ailleurs.
    Pour résumer la description de votre soucis n'est pas suffisamment précise pour qu'on sache de quoi vous parlez, donc on peut jouer à lancer le programme ou le lire et y trouver de nombreux problèmes qui n'en sont pas (enfin pour vous): on perd juste son temps et çà ne vous aide pas.
    - W
    Mon souci vient de la hauteur des frames.

    J'ai commenté dans les class para1 et para2 les lignes :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
       #self.frame = VerticalScrolledFrame(frame1)
                #self.frame.pack(fill=BOTH, expand=TRUE)
    et remplacé :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    text = Text(self.frame.interior)
    par
    La question est précise : J'aimerai d'abord savoir ce qui détermine la hauteur des frames (create_frame1(master, t))


    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
    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
    from tkinter import *
    from tkinter import ttk
     
    class VerticalScrolledFrame(Frame):
        """A pure Tkinter scrollable frame that actually works!
        * Use the 'interior' attribute to place widgets inside the scrollable frame
        * Construct and pack/place/grid normally
        * This frame only allows vertical scrolling
        """
        def __init__(self, parent, *args, **kw):
            Frame.__init__(self, parent, *args, **kw)        
     
            # create a canvas object and a vertical scrollbar for scrolling it
            vscrollbar = Scrollbar(self, orient=VERTICAL)
            vscrollbar.pack(fill=Y, side=RIGHT, expand=FALSE)
            canvas = Canvas(self, borderwidth=10, highlightthickness=0, bg="black", yscrollcommand=vscrollbar.set)
            canvas.pack(side=LEFT, fill=BOTH, expand=TRUE)
            vscrollbar.config(command=canvas.yview)
     
            # reset the view
            canvas.xview_moveto(0)
            canvas.yview_moveto(0)
     
            # create a frame inside the canvas which will be scrolled with it
            self.interior = interior = Frame(canvas, bg="beige")
            interior_id = canvas.create_window(0, 0, window=interior, anchor=NW)
     
            # track changes to the canvas and frame width and sync them,
            # also updating the scrollbar
            def _configure_interior(event):
                # update the scrollbars to match the size of the inner frame
                size = (interior.winfo_reqwidth(), interior.winfo_reqheight())
                canvas.config(scrollregion="0 0 %s %s" % size)
                if interior.winfo_reqwidth() != canvas.winfo_width():
                    # update the canvas's width to fit the inner frame
                    canvas.config(width=interior.winfo_reqwidth())
            interior.bind('<Configure>', _configure_interior)
     
            def _configure_canvas(event):
                if interior.winfo_reqwidth() != canvas.winfo_width():
                    # update the inner frame's width to fill the canvas
                    canvas.itemconfigure(interior_id, width=canvas.winfo_width())
            canvas.bind('<Configure>', _configure_canvas)
     
    def create_frame1(master, t):
     
        L = root.winfo_screenwidth()
        H = root.winfo_screenheight()
     
        frame = Frame(master, bd=0, bg="beige", padx=50, pady=30)#, relief=SUNKEN)
     
        t = "mon lab"
     
        monText = Text(frame)
        newBtn = Button(toolbar, text="Tableau", bg="maroon", fg="white", borderwidth=0, command=mesParas)
        newBtn.pack(side=LEFT, fill=X)
     
        #root.geometry("%dx%d%+d%+d" % (L,H,0,0))    
        root.update_idletasks()
        print(root.winfo_width())
        print("ok")
        print(frame.winfo_width())
     
        return frame 
     
    def ChangeColor():
     
        newBtn3.configure(bg='red')
     
     
    def mesParas ():
        para0(Tk)
        para3(Tk)   
     
    if __name__ == '__main__':
     
     
        class para0(Tk):
     
            def __init__(self, *args, **kwargs):
                for w in frame1.winfo_children():
                        w.destroy()  
                #self.frame = VerticalScrolledFrame(frame1)
                #self.frame.pack(fill=BOTH, expand=TRUE)
                text = Text(frame1)#, yscrollcommand=yscrollbar.set)
                text.tag_configure('color', underline="1", borderwidth=0, background='orange', font=('Tempus Sans ITC', 12, 'bold'))
                text.pack(fill=BOTH)
                t="kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"
                text.insert(0.0, t)
                root.update()
     
        class para3(Tk):
     
            def __init__(self, *args, **kwargs):
                #self.frame = VerticalScrolledFrame(frame1)
                #self.frame.pack(fill=BOTH, expand=TRUE)
                text = Text(frame1)#, yscrollcommand=yscrollbar.set)
                text.tag_configure('color', underline="1", borderwidth=0, background='orange', font=('Tempus Sans ITC', 12, 'bold'))
                text.pack(fill=BOTH)
                t="kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"
                text.insert(0.0, t)
                root.update()            
     
     
        class para1(Tk):
     
            def __init__(self, *args, **kwargs):
                for w in frame1.winfo_children():
                        w.destroy()  
                self.frame = VerticalScrolledFrame(frame1)
                self.frame.pack(fill=BOTH, expand=TRUE)
                text = Text(self.frame.interior)#, yscrollcommand=yscrollbar.set)
                text.tag_configure('color', underline="1", borderwidth=0, background='orange', font=('Tempus Sans ITC', 12, 'bold'))
                text.pack(fill=BOTH)
                t="jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj"
                text.insert(0.0, t)
                root.update()
     
        class para2(Tk):
     
            def __init__(self, *args, **kwargs):
                self.frame = VerticalScrolledFrame(frame1)
                self.frame.pack(fill=BOTH, expand=TRUE)   
                text = Text(self.frame.interior)#, yscrollcommand=yscrollbar.set)
                text.tag_configure('color', underline="1", borderwidth=0, background='orange', font=('Tempus Sans ITC', 12, 'bold'))
                text.pack(fill=BOTH)
                t="kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"
                text.insert(0.0, t)
                root.update()
     
        root = Tk()
        color= "lightyellow"
     
        root.title("Syntax Analyser")
     
        myColor="lightblue"
     
        toolbar = Frame(root, borderwidth=0, relief='raised', background=myColor)
        toolbar.pack(side=TOP, fill=X)
        nb = ttk.Notebook(root)
     
        # Defines and places the notebook widget
     
        root.update()
     
        numero=1
        frame1 = create_frame1(nb, numero)
        nb.add(frame1, text='Texte')
     
        ttk.Style().configure(root, background=color)
        nb.pack(fill=BOTH, expand=0)
     
        L = root.winfo_screenwidth()
        H = root.winfo_screenheight() 
        #root.geometry('{}x{}'.format(L, H))
        root.geometry("%dx%d%+d%+d" % (L,H,0,0))
     
        root.title("Close Test") 
     
        root.configure(background="green")
        root.mainloop()

  9. #9
    Expert éminent
    Homme Profil pro
    Architecte technique retraité
    Inscrit en
    Juin 2008
    Messages
    21 752
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Architecte technique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2008
    Messages : 21 752
    Par défaut
    Citation Envoyé par Arsene12 Voir le message
    La question est précise : [B][SIZE=2]J'aimerai d'abord savoir ce qui détermine la hauteur des frames
    Par défaut, les geometry manager (pack et grid) les redimensionnent en fonction des widgets qui y seront affichés. Pour plus de détails, la vraie documentation TCL/Tk est là pour çà (mais attention çà pique). Mais comme vous ne prenez toujours pas la peine d'illustrer le problème que vous rencontrez par un petit exemple, je ne vais pas me prendre le chou à essayer d'imaginer pourquoi vous posez cette question là (surtout quelle est sans rapport avec le sujet de départ à priori résolu).

    - W
    Architectures post-modernes.
    Python sur DVP c'est aussi des FAQs, des cours et tutoriels

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 1
    Dernier message: 08/08/2011, 00h54
  2. Tabs une au dessous de l'autre
    Par isitien dans le forum Mise en page CSS
    Réponses: 1
    Dernier message: 23/11/2009, 10h24
  3. [C#] Redirection d'une frame vers une page simple
    Par st0j dans le forum ASP.NET
    Réponses: 6
    Dernier message: 17/06/2005, 15h42
  4. [wxpython][wx.frame] mettre une image sur un bouton
    Par Kyti dans le forum wxPython
    Réponses: 7
    Dernier message: 02/05/2005, 12h13
  5. accéder à une frame sur une page mère
    Par lyne dans le forum Général JavaScript
    Réponses: 4
    Dernier message: 25/02/2005, 07h02

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