[Tutor] IDLE question
rdm at rcblue.com
Wed Jun 30 17:07:12 EDT 2004
Alan Gauld wrote at 12:51 6/30/2004:
> > I'm trying to enter
> > >>>if D.has_key("b"):
> > print "yes"
> > else:
> > print "no"
>Why? It's not valid Python?! :-)
You mean because the indenting has shown up incorrectly in my email? I
thought it might. Or do you mean I've used has_key() incorrectly?
> > in IDLE v1.0.3. by typing it in, line by line. lines 1 and 2 go OK,
> > hitting "Enter" after "yes" causes the cursor to move to just under
> > "p" of "print", as expected. If I use the Backspace key and the
> > to line up and indent "else:"
>But the else should not be indented, it lines up with the if.
Yes, I had typed it in my email to line up with the if.
>However a bug(at least I think its a bug!) in IDLE means that
>IDLE ignores the effect of the >>> proimpt and thinks the if is
>actually at the left margin, so your code needs to look like this:
> >>> if D.has_key("b"):
> print "yes"
> print "no"
>Which is what ISLE is trying to make you do but to a human it
>doesn't look right...
> > indentation level (<pyshell#10>, line 3)". Is there no way to get
> > entered other than typing the 4 lines in a text editor and pasting
> > all together into IDLE?
>Well you can use IDLE as that text editor by using File->NEw to create
>a new window....
I've been doing this. I should have said I was trying to use IDLE's
>If you want a >>> prompt with the color coding and other bells of IDLE
>try the pyShell that comes with wxPython. It is now my preferred
>Python interactive prompt...
To use the pyShell that comes with wxPython, I'd have to download and
install and use all of wxPython, I suppose. I just read about wxPython on
it's website, and I'm interested in what is said there about having the
best GUI toolkit. But if I switch to wxPython, except for not using
tkinter, will I be able to rely on the Python documentation, tutorials
and books for learning Python? I'm guessing I can, but can you confirm this?
Also, on the wxPython main page it says, "Welcome to the home of
wxPython, a blending of the wxWidgets C++ class library with the Python
programming language." Does this mean I'd have to know C++ to use the
wxWidgets? Or is it the case that I would no more need to know C++ for
wxPython than I need to know C to use Python.
I'm running Windows XP Pro, and am currently using Python 2.3.4.
More information about the Tutor