Text in Tkinter | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?

10th Jul 2020, 1:01 PM
Leo Drouin
Leo Drouin - avatar
16 Answers
10th Jul 2020, 1:13 PM
Leo Drouin
Leo Drouin - avatar
+ 2
Yes it's working and very easier, thanks !
10th Jul 2020, 1:59 PM
Leo Drouin
Leo Drouin - avatar
+ 1
Do you have any other widgets in the window?
10th Jul 2020, 1:03 PM
Slick
Slick - avatar
+ 1
Yes I have labels and buttons
10th Jul 2020, 1:03 PM
Leo Drouin
Leo Drouin - avatar
+ 1
alright, copy and paste the whole thing in the playground and link it here. dont sound too bad
10th Jul 2020, 1:05 PM
Slick
Slick - avatar
+ 1
Have you learned about Frames yet?
10th Jul 2020, 1:19 PM
Slick
Slick - avatar
+ 1
Yes
10th Jul 2020, 1:19 PM
Leo Drouin
Leo Drouin - avatar
+ 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
10th Jul 2020, 1:21 PM
Slick
Slick - avatar
+ 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
10th Jul 2020, 1:27 PM
Leo Drouin
Leo Drouin - avatar
+ 1
okay, what exactly were you trying to do with the scrollbar and textbox i didnt get it?
10th Jul 2020, 1:28 PM
Slick
Slick - avatar
+ 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
10th Jul 2020, 1:31 PM
Leo Drouin
Leo Drouin - avatar
+ 1
And sorry if I do mistakes in English, I'm french
10th Jul 2020, 1:31 PM
Leo Drouin
Leo Drouin - avatar
+ 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
10th Jul 2020, 1:38 PM
Slick
Slick - avatar
+ 1
And i have honestly never seen lines 15 & 16 before. i know the command keyword but I'm lost with those attributes
10th Jul 2020, 1:42 PM
Slick
Slick - avatar
+ 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
10th Jul 2020, 1:45 PM
Leo Drouin
Leo Drouin - avatar
+ 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)
10th Jul 2020, 1:47 PM
Slick
Slick - avatar