Re re problème de scrollbar
Pr.Witherfire
-
Phil_1857 Messages postés 1872 Date d'inscription Statut Membre Dernière intervention -
Phil_1857 Messages postés 1872 Date d'inscription Statut Membre Dernière intervention -
Bonjour. J'aimerais faire fonctionner un scrollbar dans ce cas là:
from tkinter import * F = Tk() Color1 = "white" Color2 = "black" Police = "Impact" F.title("Menu") F.geometry("1600x900+-8+0") Sb = Scrollbar(F, orient='vertical') Sb.pack(side=RIGHT, fill='y') C = Canvas(F, bg=Color2, width=1525, height=6000, yscrollcommand=Sb.set, bd=0) Frame = Frame(F, bg=Color1, width=1525, height=6000) for i in range(5): Nom = i globals()["Frame"+str(Nom)]= Canvas(Frame, bg=Color2, width=400, height=285, bd=0) if i == 0: x=0 y=0 else: x=x+250 y=y+150 globals()["Frame" + str(Nom)].place(x=x, y=y) Frame.place(x=0, y=270) C.place(x=0, y=270) Sb.config(command=C.yview) F.mainloop()
mais je n'y arrive pas pouvez vous m'aider merci au revoir
A voir également:
- Python frame scrollbar
- Citizen code python avis - Accueil - Outils
- Mot secret python pix ✓ - Forum Python
- \R python ✓ - Forum Python
- Afficher un message sur python "" ✓ - Forum Python
- Python est introuvable. exúcutez sans argument pour procúder ó l ✓ - Forum Python
3 réponses
yg_be
Messages postés
23541
Date d'inscription
Statut
Contributeur
Dernière intervention
Ambassadeur
1 584
bonjour,
je pense que ceci t'aidera: https://forums.commentcamarche.net/forum/affich-37803007-scrollbar-sur-groupe-de-wigets#3
yg_be
Messages postés
23541
Date d'inscription
Statut
Contributeur
Dernière intervention
Ambassadeur
1 584
ton if dans la boucle for est très barbare.
Au lieu de
for i in range(5): if i == 0: x=0 else: x=x+250 print(x)
Il est plus clair et plus efficace d'écrire
x=0 for i in range(5): print(x) x=x+250
Ou même
for i in range(5): x=i*250 print(x)
Bonjour,
Par contre je vois que tu continues à utiliser globals() malgré les remarques précédentes
Il suffit de faire ça:
frame = Frame(F, bg=Color1, width=1525, height=6000) for i in range(5): frame[i]= Canvas(Frame, bg=Color2, width=400, height=285, bd=0)
Et des noms de widgets qui sont des mots réservés de Python:
Frame = Frame(.....) !