python strings and {} in Tkinter entry widgets

Discussion in 'Python' started by Chris Hare, Aug 16, 2010.

  1. Chris Hare

    Chris Hare Guest

    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
     
    Chris Hare, Aug 16, 2010
    #1
    1. Advertising

  2. Chris Hare

    Jeff Hobbs Guest

    On Aug 15, 4:41 pm, Chris Hare <> 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
     
    Jeff Hobbs, Aug 16, 2010
    #2
    1. Advertising

  3. Chris Hare

    Chris Hare Guest

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

    > On Aug 15, 4:41 pm, Chris Hare <> 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
     
    Chris Hare, Aug 16, 2010
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=

    Placing entry widgets on a canvas in Tkinter

    =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=, Jun 30, 2003, in forum: Python
    Replies:
    0
    Views:
    433
    =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=
    Jun 30, 2003
  2. =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=

    Re: Placing entry widgets on a canvas in Tkinter

    =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=, Jun 30, 2003, in forum: Python
    Replies:
    0
    Views:
    995
    =?ISO-8859-1?Q?Mickel_Gr=F6nroos?=
    Jun 30, 2003
  3. Marc
    Replies:
    1
    Views:
    355
    Rodrigo Benenson
    Jan 27, 2004
  4. Atul
    Replies:
    2
    Views:
    383
  5. Arnaud Delobelle

    Tkinter bug in Entry widgets on OS X

    Arnaud Delobelle, Aug 31, 2012, in forum: Python
    Replies:
    7
    Views:
    276
    Arnaud Delobelle
    Sep 1, 2012
Loading...

Share This Page