Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1656 connectés 

  FORUM HardWare.fr
  Programmation
  Python

  Inserer des Labelframe dans des Frames

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Inserer des Labelframe dans des Frames

n°2246257
xunil2003
Posté le 16-12-2014 à 12:33:27  profilanswer
 

Bonjour,
 
Je suis débutant python 2.7.x, mon gui est Tkinter.
Je voudrais mettre plusieurs Labelframe à côté l'un de l'autre dans plusieurs frames.
Chaque frame doit être l'une en dessous de l'autre.
genre :
 
+-----------------------------------------------------------------------------------------+
|  Frame1                                                                                                |
|                                                                                                            |
|  +--LabelFrame1--------+  +--LabelFrame3--------+  +--LabelFrame3--------+  |
|  |                              |   |                              |   |                              |   |
|  |                              |   |                              |   |                              |   |
|  +------------------------+  +------------------------+  +------------------------+   |
|                                                                                                            |
+-----------------------------------------------------------------------------------------+
 
+-----------------------------------------------------------------------------------------+
|  Frame2                                                                                                |
|                                                                                                            |
|  +--LabelFrame1--------+  +--LabelFrame3--------+  +--LabelFrame3--------+  |
|  |                              |   |                              |   |                              |   |
|  |                              |   |                              |   |                              |   |
|  +------------------------+  +------------------------+  +------------------------+   |
|                                                                                                            |
+-----------------------------------------------------------------------------------------+
 
Mais je n'y arrive pas.
Tous les frames se place l'une a côté de l'autre au lieu d'être en dessous l'une des l'autres.
Et les LabelFrames se place l'une en dessous des autres au lieu de ce placer l'une a coté de l'autre.
 
Mon code :

Code :
  1. #!/usr/bin/PYTHON
  2. # -*-coding:utf-8 -*
  3. from Tkinter import *
  4. from xml.dom import minidom 
  5. xmldoc = minidom.parse('/home/laurent/python/appli/controleur_04-07-2014_0104.xml')
  6. print xmldoc
  7. print xmldoc.toxml()
  8. root = Tk()
  9. root.title('Contrôleur')
  10. scrollbar = Scrollbar(root)
  11. scrollbar.pack( side = RIGHT, fill=Y )
  12. Frame1 = Frame(root, borderwidth=1, relief=GROOVE)
  13. Frame1.pack(side=LEFT, padx=10, pady=10)
  14. Label(Frame1, text="Frame 1" ).pack(padx=10, pady=10)
  15. # LabelFrame 1
  16. f01 = Frame(Frame1, width=800, height=140)
  17. xf01 = Frame(f01, relief=GROOVE, borderwidth=2)
  18. Label(xf01, text="Consomation : " ).pack(pady=10)
  19. Label(xf01, text="Test 01" ).pack(pady=5)
  20. Button(xf01, text="On", command=root.quit).pack(side=LEFT, padx=5, pady=8)
  21. Button(xf01, text="Off", command=root.quit).pack(side=RIGHT, padx=5, pady=8)
  22. xf01.place(relx=0.01, rely=0.125, anchor=NW)
  23. Label(f01, text='Pièce 1').place(relx=0.06, rely=0.125,anchor=W)
  24. f01.pack()
  25. # LabelFrame 2
  26. f02 = Frame(Frame1, width=400, height=110)
  27. xf02 = Frame(f02, relief=GROOVE, borderwidth=2)
  28. Label(xf02, text="Test 02" ).pack(pady=10)
  29. Button(xf02, text="On", state=DISABLED).pack(side=LEFT, padx=5, pady=8)
  30. Button(xf02, text="Off", command=root.quit).pack(side=RIGHT, padx=5, pady=8)
  31. xf02.place(relx=0.01, rely=0.125, anchor=NW)
  32. Label(f02, text='Titre').place(relx=.06, rely=0.125,anchor=W)
  33. f02.pack()
  34. # Frame2
  35. Frame2 = Frame(root, borderwidth=1, relief=GROOVE)
  36. Frame2.pack(side=LEFT, padx=10, pady=10)
  37. Label(Frame2, text="Frame 2" ).pack(padx=10, pady=10)
  38. # LabelFrame 3
  39. f03 = Frame(Frame2, width=300, height=110)
  40. xf03 = Frame(f03, relief=GROOVE, borderwidth=2)
  41. Label(xf03, text="Test 03" ).pack(pady=10)
  42. Button(xf03, text="On", state=DISABLED).pack(side=LEFT, padx=5, pady=8)
  43. Button(xf03, text="Off", command=root.quit).pack(side=RIGHT, padx=5, pady=8)
  44. xf03.place(relx=0.01, rely=0.125, anchor=NW)
  45. Label(f03, text='Titre').place(relx=.06, rely=0.125,anchor=W)
  46. f03.pack()
  47. # LabelFrame 4
  48. f04 = Frame(Frame2, width=300, height=110)
  49. xf04 = Frame(f04, relief=GROOVE, borderwidth=2)
  50. Label(xf04, text="Test 04" ).pack(pady=10)
  51. Button(xf04, text="On", state=DISABLED).pack(side=LEFT, padx=5, pady=8)
  52. Button(xf04, text="Off", command=root.quit).pack(side=RIGHT, padx=5, pady=8)
  53. xf04.place(relx=0.01, rely=0.125, anchor=NW)
  54. Label(f04, text='Titre').place(relx=.06, rely=0.125,anchor=W)
  55. f04.pack()
  56. # LabelFrame 5
  57. f05 = LabelFrame(Frame2, text="Titre de la frame", padx=20, pady=20)
  58. f05.pack(fill="both", expand="yes" )
  59. Label(f05, text="A l'intérieure de la frame" ).pack()
  60. root.mainloop()


 
Comment dois-je faire ?
Pouvez-vous m'aiguiller ?
 
Merci.


Message édité par xunil2003 le 16-12-2014 à 13:12:00
mood
Publicité
Posté le 16-12-2014 à 12:33:27  profilanswer
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Python

  Inserer des Labelframe dans des Frames

 

Sujets relatifs
Insérer une ligne en dessous d'un contenu précisProblème pour insérer des données sur MySQL
Insérer un séparateur dans un fichier texteAncres entre frames, xml, html
problème pour inserer des données dans une table à partir d'un JframeInsérer une image aulieu de courbe en JAVA
[Résolu] Insérer un caractère dans une chaine à une position donnéeInsérer un script Google Maps dans Joomla
Insérer un slider dans ma page[Qt Débutant] Insérer une icone dans un bouton
Plus de sujets relatifs à : Inserer des Labelframe dans des Frames


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR