Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > python strings and {} in Tkinter entry widgets

Reply
Thread Tools

python strings and {} in Tkinter entry widgets

 
 
Chris Hare
Guest
Posts: n/a
 
      08-15-2010
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
 
Reply With Quote
 
 
 
 
Jeff Hobbs
Guest
Posts: n/a
 
      08-16-2010
On Aug 15, 4:41*pm, Chris Hare <(E-Mail Removed)> wrote:
> 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
 
Reply With Quote
 
 
 
 
Chris Hare
Guest
Posts: n/a
 
      08-16-2010

On Aug 16, 2010, at 11:40 AM, Jeff Hobbs wrote:

> On Aug 15, 4:41 pm, Chris Hare <(E-Mail Removed)> wrote:
>> 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
> --
> http://mail.python.org/mailman/listinfo/python-list


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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tkinter bug in Entry widgets on OS X Arnaud Delobelle Python 7 09-01-2012 12:56 PM
Tkinter Entry widgets 'font' property (API ?) changed in Python 2.5.2? Atul Python 2 08-09-2008 07:51 AM
Pickling Tkinter widgets - Where does Python stand now? Marc Python 1 01-27-2004 12:30 PM
Re: Placing entry widgets on a canvas in Tkinter =?ISO-8859-1?Q?Mickel_Gr=F6nroos?= Python 0 06-30-2003 01:02 PM
Placing entry widgets on a canvas in Tkinter =?ISO-8859-1?Q?Mickel_Gr=F6nroos?= Python 0 06-30-2003 12:34 PM



Advertisments