python strings and {} in Tkinter entry widgets

C

Chris Hare

I have some code that pulls a value from a database. In this case, it is three space delimited words. When I display the value in a Tkinter.Entry widget, the text has curly braces around it, even when there are none in the surrounding the text in the database.

Is this normal, and how do I prevent it or remove them correctly before displaying the text in the Entry widget?

Thanks
 
J

Jeff Hobbs

I have some code that pulls a value from a database.  In this case, it is three space delimited words.  When I display the value in a Tkinter.Entry widget, the text has curly braces around it, even when there are none in the surrounding the text in the database.

Is this normal, and how do I prevent it or remove them correctly before displaying the text in the Entry widget?

Python ['', '', ''] == Tcl {{} {} {}}
Python 'a word' == Tcl {a word}

You are getting a literal translation occurring, and you need to split/
join or index the items properly. Without being more clear how you
want to represent your data, what you need isn't clear. Perhaps you
just need to reference the first index of the variable, or ... who
knows, there are lots of possibilities.

Jeff
 
C

Chris Hare

I have some code that pulls a value from a database. In this case, it is three space delimited words. When I display the value in a Tkinter.Entry widget, the text has curly braces around it, even when there are none in the surrounding the text in the database.

Is this normal, and how do I prevent it or remove them correctly before displaying the text in the Entry widget?

Python ['', '', ''] == Tcl {{} {} {}}
Python 'a word' == Tcl {a word}

You are getting a literal translation occurring, and you need to split/
join or index the items properly. Without being more clear how you
want to represent your data, what you need isn't clear. Perhaps you
just need to reference the first index of the variable, or ... who
knows, there are lots of possibilities.

Jeff

Actually I want all of the words, as they form the name of an organization entered by the user. So the space delimited words should be displayed without the {} in the tkinker entry box. The contents of the widget is a persons first and last name, space delimited
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top