Python

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • GUI new project

    5 answers - 966 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    As a new guy, I was trying to write a simple unit conversion
    program in Tk. I got this error message:TclError: unknown option "-command"
    Traceback (most recent call last):
    File
    "D:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
    line 310, in RunScript
    exec in __maindict__
    File "D:\Python24\Convert it\Tk Grid demo2py.py", line 70, in ?
    main()
    File "D:\Python24\Convert it\Tk Grid demo2py.py", line 67, in main
    Application().mainloop()
    File "D:\Python24\Convert it\Tk Grid demo2py.py", line 22, in __init__
    , relief=SUNKEN)
    File "D:\Python24\lib\lib-tk\Tkinter.py", line 2409, in __init__
    Widgetinit__(self, master, 'listbox', cnf, kw)
    File "D:\Python24\lib\lib-tk\Tkinter.py", line 1862, in __init__
    self.tk.call(
    TclError: unknown option "-command"
    Any Ideas?
    Joe Cox
    513-293-4830
    Tutor maillist - Tutor (AT) python (DOT) org
  • No.1 | | 534 bytes | |



    """Create the Second ListBox"""

    self.lbRSSItems = Listbox(self, exportselection=0
    ,command=self.reveal
    , relief=SUNKEN)

    Because whitespace is important in python,
    you can't arbitrarily put newlines into your text.
    Your program is getting confused because it doesn't know what ',
    relief=SUNKEN)' means.
    Try putting a '\' before your newlines.
    Like:
    x = \
    'a'

    HTH,
    -Luke

    Tutor maillist - Tutor (AT) python (DOT) org
  • No.2 | | 1163 bytes | |

    Joe Cox wrote:
    As a new guy, I was trying to write a simple unit conversion
    program in Tk. I got this error message:TclError: unknown option "-command"
    --

    Traceback (most recent call last):

    File
    "D:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
    line 310, in RunScript
    exec in __maindict__
    File "D:\Python24\Convert it\Tk Grid demo2py.py", line 70, in ?
    main()
    File "D:\Python24\Convert it\Tk Grid demo2py.py", line 67, in main
    Application().mainloop()
    File "D:\Python24\Convert it\Tk Grid demo2py.py", line 22, in __init__
    , relief=SUNKEN)
    File "D:\Python24\lib\lib-tk\Tkinter.py", line 2409, in __init__
    Widgetinit__(self, master, 'listbox', cnf, kw)
    File "D:\Python24\lib\lib-tk\Tkinter.py", line 1862, in __init__
    self.tk.call(
    TclError: unknown option "-command"

    Any Ideas?

    self.lbSites = Listbox(self,command=self.reveal, exportselection=0
    , relief=SUNKEN)

    Acually I think it was this line that was causing trouble first :)
    Same reason, though.
    Cheers,
    -Luke

    Tutor maillist - Tutor (AT) python (DOT) org
  • No.3 | | 328 bytes | |

    "Joe Cox" <jgcox39 (AT) highstream (DOT) netwrote
    As a new guy, I was trying to write a simple unit conversion
    program in Tk. I got this error message:TclError: unknown option
    "-command"

    Which says that you are using an unknown option command

    ie. Listboxes don't have a command option.

    HTH,
  • No.4 | | 782 bytes | |

    Sunday 22 2006 20:03, Luke Paireepinart wrote:
    """Create the Second ListBox"""

    self.lbRSSItems = Listbox(self, exportselection=0
    ,command=self.reveal
    , relief=SUNKEN)

    Because whitespace is important in python,
    you can't arbitrarily put newlines into your text.
    Your program is getting confused because it doesn't know what ',
    relief=SUNKEN)' means.
    Try putting a '\' before your newlines.
    Like:
    x = \
    'a'
    --
    HTH,
    -Luke
    I'm not an expert Luke but I thought a statement can take more than one line
    when enclosed in parentheses, square brackets or braces (also when triple
    quoted). Is this correct?

    John

    Tutor maillist - Tutor (AT) python (DOT) org
  • No.5 | | 1333 bytes | |

    johnf wrote:
    Sunday 22 2006 20:03, Luke Paireepinart wrote:

    """Create the Second ListBox"""

    self.lbRSSItems = Listbox(self, exportselection=0
    ,command=self.reveal
    , relief=SUNKEN)

    >Because whitespace is important in python,
    >you can't arbitrarily put newlines into your text.
    >Your program is getting confused because it doesn't know what ',
    >relief=SUNKEN)' means.
    >Try putting a '\' before your newlines.
    >Like:
    >x = \
    >'a'
    >>
    >>

    >HTH,
    >-Luke
    >

    I'm not an expert Luke but I thought a statement can take more than one line
    when enclosed in parentheses, square brackets or braces (also when triple
    quoted). Is this correct?

    Yep, yep.
    I confess, I didn't look too closely at that, and I guess I heard one
    should use backslashes whenever a command goes to a new line,
    and I assumed it was always true, and never tried without them!
    You're right, of course, John, and I apologize to the P. Alan had the
    correct answer to the problem.
    Listboxes don't take a command argument.

    Hope that helps!
    -Luke

    Tutor maillist - Tutor (AT) python (DOT) org

Re: GUI new project


max 4000 letters.
Your nickname that display:
In order to stop the spam: 4 + 2 =
QUESTION ON "Python"

EMSDN.COM