loading...

How to stop TKinter Text widget from having more than 1 line

twitter logo github logo ・1 min read

Hey, Devs!
I am new to the Python TKinter scene, and observed it's pretty similar to how a JFrame works in Java, with a few noticeable differences,
and one I see right now is that TextField and TextArea are merged into one big widget: Text, but I only want a TextField (only 1 line of text), but when I do

textfield.config(wrap="none")

it stops text wrap, but if you press Enter a new-line character will be placed. is there any way around this?
Thanks!
Cheers!

twitter logo DISCUSS (2)
markdown guide
 

I think you should use Entry. It's Exactly what you want as you mentioned above.
Learn More About Entry Here

 
Classic DEV Post from Sep 20 '18

My Journey from PHP to Go

One week of Go dev for a PHP dev

PDS OWNER CALIN (Calin Baenen) profile image
I am a 13 (as of Oct 30 of 2019) yr/o developer (I have been developing mini-projects for 4, years now, since I was 9), who makes projects in languages like: Java, HTML, Python 3, JS, CSS, and C#.