Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   python strings and {} in Tkinter entry widgets (http://www.velocityreviews.com/forums/t731030-python-strings-and-in-tkinter-entry-widgets.html)

Chris Hare 08-15-2010 11:41 PM

python strings and {} in Tkinter entry widgets
 
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

Jeff Hobbs 08-16-2010 04:40 PM

Re: python strings and {} in Tkinter entry widgets
 
On Aug 15, 4:41*pm, Chris Hare <ch...@labr.net> 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

Chris Hare 08-16-2010 05:11 PM

Re: python strings and {} in Tkinter entry widgets
 

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

> On Aug 15, 4:41 pm, Chris Hare <ch...@labr.net> 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


All times are GMT. The time now is 02:57 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.