Scroll bar qui ne marche pas

Résolu
Pr.Witherfire -  
 Pr.Witherfire -

Bonjour j'ai un code avec un Scroll qui ne marche pas.

from tkinter import *

F = Tk()

Sb = Scrollbar(F, orient='vertical')
Sb.pack(side=RIGHT, fill='y')

C = Canvas(F, bg="red", width=1525, height=6000, yscrollcommand=Sb.set, bd=0)

Frame = Frame(C, bg="blue", width=1525, height=6000)

for i in range(20):

    globals()["B"+str(i)]=Button(F, text="Bonjour")
    globals()["B" + str(i)].place(x=100, y=100*i)

F.mainloop()

Pouvez vous m'aider merci bonne soirée

3 réponses

  1. Phil_1857 Messages postés 1883 Date d'inscription   Statut Membre Dernière intervention   169
     

    Bonjour,

    Il manque des trucs pour que ça fonctionne : regarde les exemples sur internet

    pas terrible ce truc-là:

    Frame = Frame(C, bg="blue", width=1525, height=6000)

    Le nom du Frame est le mot réservé Python Frame

    Pas terrible non plus, ce truc de globals() , et d'ailleurs, quel intérêt ? :

    globals()["B"+str(i)]=Button(F, text="Bonjour")
    0
    1. Pr.Witherfire
       

      Ok merci beaucoup

      0
  2. Pr.Witherfire
     

    Rebonjour j'ai cherché sur internet je n'ai toujours rien trouvé. Il manque quoi à peu près ?

    -1