+ 1
Text in Tkinter
My line is Text=Tkinter.Text(window, height=5, width=30, font=("Courrier",25)) Text.pack() And there is just the scrollbar in the window And if I write Text.pack(fill=X) There is a text area but with just one column So I think the issue is with my arguments width and height but I don't understand Can anyone help me please?
16 Respuestas
+ 2
Yes it's working and very easier, thanks !
+ 1
Do you have any other widgets in the window?
+ 1
Yes I have labels and buttons
+ 1
alright, copy and paste the whole thing in the playground and link it here. dont sound too bad
+ 1
Have you learned about Frames yet?
+ 1
Yes
+ 1
Nice, i would add a couple frames to the main window. then add widgets to the frames instead of directly on the main window.
Easier to manage and space out, then you can safely work within each frame
+ 1
I understand that and i'll try, but I would like to understand why it's not working like that, if you saw what is wrong
+ 1
okay, what exactly were you trying to do with the scrollbar and textbox i didnt get it?
+ 1
The goal is the user writes a message in the text box, and valid with a button. After that an algorithm change the string wrote and print it in a second textbox
+ 1
And sorry if I do mistakes in English, I'm french
+ 1
No worries man. And i was just wondering what the point of the scrollbar is.
I would personally start with taking that out.
Then i would lay each label, button, and text box, and after all that I'd worry about commands.
(you can set the text variable of most text boxes to a tk.StringVar() then call on them whenever)
Make some functions
you can use .insert() and .get() to put and retreive values in text boxes.
THEN connect the functions to the buttons
+ 1
And i have honestly never seen lines 15 & 16 before. i know the command keyword but I'm lost with those attributes
+ 1
Oh sorry, the scrollbar is just to see easily what is in the box of the text is long, it's not really useful but I wanted to try to use it.
I tried without the scrollbar and effectively it's working, so I'll do without that for now and I'll try to add them after.
I don't know StringVar(), I will study it and try that. Thanks a lot
+ 1
OH! you shoulda said somethin!
from tkinter import scrolledtext
put that line right at the top, and make one and pack it like you would a text box bro. This is exactly what you want
textbox = scrolledtext.ScrolledText(w, width=15)