NameError

Discussion in 'Python' started by GMTaglia, Oct 5, 2004.

  1. GMTaglia

    GMTaglia Guest

    Hi guys,

    probably dumb question but after googling a lot I couldn't find an answer.
    with a simple Gtk:Dialog I have this error:

    Traceback (most recent call last):
    File "elenco.py", line 122, in show_msg
    dialog.vbox.pack_start(label, TRUE, TRUE, 0)
    NameError: global name 'TRUE' is not defined

    This surprising me a lot, I don't understand what is wrong,

    Here is the code:

    def show_msg(self, widget):
    dialog = gtk.Dialog("Info Box", None, 0, (gtk.STOCK_CLOSE,
    gtk.RESPONSE_CLOSE))
    label = gtk.Label("Dialogs are groovy")
    dialog.vbox.pack_start(label, TRUE, TRUE, 0)
    label.show()

    very simple (hope the mistake is here)

    I have python 2.3.4 Installed with pygtk 2.4.0 on Gentoo GNU/Linux.

    Thank's to everybody in advance.
    Cheers, Mario
    GMTaglia, Oct 5, 2004
    #1
    1. Advertising

  2. GMTaglia

    Paul McNett Guest

    GMTaglia writes:

    > dialog.vbox.pack_start(label, TRUE, TRUE, 0)


    Try changing that to:
    dialog.vbox.pack_start(label, True, True, 0)

    If that doesn't work, try:
    dialog.vbox.pack_start(label, 1, 1, 0)

    --
    Paul McNett
    Independent Software Consultant
    http://www.paulmcnett.com
    Paul McNett, Oct 5, 2004
    #2
    1. Advertising

  3. GMTaglia

    GMTaglia Guest

    Answering to myself....

    > probably dumb question but after googling a lot I couldn't find an answer.
    > with a simple Gtk:Dialog I have this error:


    yep really dumb

    >
    > Traceback (most recent call last):
    > File "elenco.py", line 122, in show_msg
    > dialog.vbox.pack_start(label, TRUE, TRUE, 0)
    > NameError: global name 'TRUE' is not defined
    >


    I just thought that TRUE (uppercase) was valid python....or not... :)

    Cheers, Mario
    GMTaglia, Oct 5, 2004
    #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. seancron

    nameerror upon calling function

    seancron, Sep 1, 2007, in forum: Python
    Replies:
    1
    Views:
    345
    Arnaud Delobelle
    Sep 1, 2007
  2. Replies:
    10
    Views:
    448
  3. jolly
    Replies:
    2
    Views:
    563
    jolly
    Dec 19, 2007
  4. Replies:
    3
    Views:
    581
    Dan Bishop
    Mar 22, 2008
  5. Lalit
    Replies:
    1
    Views:
    722
    Diez B. Roggisch
    Apr 24, 2008
Loading...

Share This Page