Text dans Scroll, dans Frame (grid), dans root [Debutant]
Bonjour,
Je reviens vous voir avec un nouveau sujet sur lequel je suis totalement débutant.
Je cherche à faire une zone de texte de plusieurs lignes avec Text(root, height, width). Ça c'est bon, j'y suis arrivé.
Afficher mon Text dans une Frame dans le Root, aussi.
Par contre, je rencontre quelques problèmes pour intégrer deux scrollBar (une verticale et une horizontale) afin d'y loger un texte long.
Comme c'est une fenêtre qui servira à saisir du code, j'ai besoin de place.
Actuellement, j'ai établi un premier source :
Code:
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
| #Include
import serial #PySerial
from tkinter import*
root = Tk()
#Variable custom
vers = "1.0"
name = "Test Scroll"
#Window custom
root.title(name + " - V " + vers)
root.resizable(True, True)
root.geometry("1080x600+100+20")
root.minsize(480, 360)
#Widget
editFrame = Frame(root, borderwidth = 2) #Editeur
consolFrame = Frame(root, borderwidth = 2) #Console
#Text in Frame and Scroll
editText = Text(editFrame, height = 100, width = 30)
editTextScroll = editFrame.Scrollbar(editFrame, command = editText.yview)
editTestScroll.pack()
editTestScroll.grid(column = 0, row = 0)
consolFrame.grid(column = 1, row = 0)
#Loop
root.mainloop() |
Et bien entendu, j'ai quelques erreurs :
Citation:
==== RESTART: C:/AlexBoxWork/C/Python/Test-Windows/Test-Ykinter-Scroll.py ====
Traceback (most recent call last):
File "C:/AlexBoxWork/C/Python/Test-Windows/Test-Ykinter-Scroll.py", line 22, in <module>
editTextScroll = editFrame.Scrollbar(editFrame, command = editText.yview)
AttributeError: 'Frame' object has no attribute 'Scrollbar'
>>>
Merci pour votre aide.