Re: [Tutor] can i pass a list to a function and get one back ?

2006-10-22 Thread shawn bright
way cool, thanks. I am always looking for ways to clean things up-skOn 10/21/06, Danny Yoo [EMAIL PROTECTED]
 wrote: great, thanks,i have idle right here, would have been just as easy.
 sorry about thatNo problem; it's cool.  hey there, i was just wondering if i could get a list back from a  function.  something like  def return_a_list(some_var):
  some_list = []  for i in range(5):  var = some_var + i  some_list.append(var)  return some_list  is this cool ?
It's cool.*grin*One small comment: we often don't need to use temporary variables like'var'.def return_a_list(some_var):some_list = []for i in range(5):some_list.append(some_var + i)
return some_listSometimes a temporary variable is useful, and sometimes not.Here, itseems like it's not too necessary.Good luck!
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] 5 questions

2006-10-22 Thread Pine Marten


1. Is there a searchable archive of this list?

2. Is there list ettiquette one should be aware of?

3. Besides Vaults of Parnassus, are there other webpages which list projects 
written in Python?  I'm mainly interested in looking at non-technical 
software, things for the common user to use.  I've been surprised at just 
how little of that type I've found so far.

4. Can anyone recommend good books for non-programmers starting out learning 
Python?  I've looked through a few so far and they are ok (Learning 
Python, Python: How to Program) but am still hoping to find one that 
doesn't assume any prior knowledge of programming and defines terms when 
they are first presented.  (That might be a tall order, I know...)

5. If I want to take user information from text boxes, check boxes, etc., 
and store it for later re-display to the person (imagine a movie rating 
diary, with text review of the film and checkboxes or sliders to give it 5 
stars, or has action, or is a comedy, etc.) and have all of it be 
efficiently searchable, what are some good ways to go in terms of how to 
save the information?  For now I have textbox info saving just to a .txt 
file, but that can't be a good way to go about it.  I have the vague sense I 
should learn about databases, but really am not sure what to read about... 
Suggestions?

_
All-in-one security and maintenance for your PC.  Get a free 90-day trial! 
http://clk.atdmt.com/MSN/go/msnnkwlo005002msn/direct/01/?href=http://www.windowsonecare.com/?sc_cid=msn_hotmail

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] 5 questions

2006-10-22 Thread Alan Gauld
 1. Is there a searchable archive of this list?

Yes, the ActiveState archive is searchable.
The gmane version might be too?

 2. Is there list ettiquette one should be aware of?

Yes, but I'm not sure how you get a copy.
Moderators???

 3. Besides Vaults of Parnassus, are there other webpages which list 
 projects
 written in Python?  I'm mainly interested in looking at 
 non-technical
 software, things for the common user to use.  I've been surprised at 
 just
 how little of that type I've found so far.

Thee are a few such sites around. The Vaults seem to be falling into
obsolesece now, although its still my first choice. Others will give 
you
their favourites I'm sure.

 4. Can anyone recommend good books for non-programmers starting out 
 learning
 Python?  I've looked through a few so far and they are ok (Learning
 Python, Python: How to Program) but am still hoping to find one 
 that
 doesn't assume any prior knowledge of programming and defines terms 
 when
 they are first presented.  (That might be a tall order, I know...)

Well, my book assumes zero knowledge and tries to define all terms
as they arise. The book is quite old in Python terms but because it is
a basics book only it still works quite well, the only significant 
drop off
is that it uses the old string module rather than the newer string
methods.

Ivan Lanningham's Teah Yourself Python... is also targetted at
complete beginners but also is focussed on version 1.5.1 with the
same failings.

I believe there are a couple of newer books around for beginners too,
but I confess I havemn't kept up to date on that front. There are so
many Python books available now we are spoilt for choice.

That having been said I personally tend to recommend sticking
with web based tutorials in the beginning since novice books
become irrelevant fairly quickly. The web sites tend to be updated
more often than books too. My book uses Python 1.5.1, but the
web tutor is for Python 2.3

 5. If I want to take user information from text boxes, check boxes, 
 etc.,
 and store it for later re-display to the person (imagine a movie 
 rating
 diary, with text review of the film and checkboxes or sliders to 
 give it 5
 stars, or has action, or is a comedy, etc.) and have all of it be
 efficiently searchable, what are some good ways to go in terms of 
 how to
 save the information?  For now I have textbox info saving just to a 
 .txt
 file, but that can't be a good way to go about it.  I have the vague 
 sense I
 should learn about databases, but really am not sure what to read 
 about...

Yes databases are a good searchable storage facility.
There is a database topic in my web tuitorial that should be enough
to get you started.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] can i pass a list to a function and get one back ?

2006-10-22 Thread Kent Johnson
Danny Yoo wrote:
 One small comment: we often don't need to use temporary variables like 
 'var'.
 
 def return_a_list(some_var):
 some_list = []
 for i in range(5):
 some_list.append(some_var + i)
 return some_list
 
 Sometimes a temporary variable is useful, and sometimes not.  Here, it 
 seems like it's not too necessary.

some_list is not too necessary either; this is a good place for a list 
comprehension:
def return_a_list(some_var):
   return [ some_var + i for i in range(5) ]

or for that matter
   return range(some_var:some_var+5)

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Exception and sys.exit() in a cgi script

2006-10-22 Thread Michael P. Reilly
On 10/21/06, Paulino [EMAIL PROTECTED] wrote:



  
  




  Mike Hansen 
Mike.Hansen at atmel.com   

Mon Oct 16 18:43:29 CEST 2006
 This is a peace of a CGI script i have.  1 import cgi 2 form=cgi.FieldStorage() 3 try : 4 ano=form[ano].value
 5 conta=form[conta].value 6 except KeyError : 7 print 'htmlbrbrbodypPlease enter values in the fields/p/body/html '
 8 sys.exit(0)   When the excption occurs, no message is shown on the browser.  If I run the script with IDLE, the message is printed and then the
 script exits.  What's wrong here?___ Tutor maillist  -  
Tutor at python.org
 http://mail.python.org/mailman/listinfo/tutor

  I'm catching up on the weekend's tutor messages.import cgitb; cgitb.enable()That spits errors to the web page which is great for debugging cgiscripts.I think you needprint Content-Type: text/html\n\n 
http://docs.python.org/lib/cgi-intro.html

http://docs.python.org/lib/node560.html

Mike


Thats not the point (sorry).

when all the values are provided in the form (no excetion is raised) it
runs as expected!

The point is when one of the values ano, conta is missing in the
form, I want the error message to be shown on the browser, and the
script to stop running.

When there is an exception, the script actually stops running, but no
message is sent to the browser.Actually, this is the point. The first lines of output from your CGI script, even on an error, needs to be header information to the web server and to the web browser, then a blank line, and 
then the content to be displayed (text, html, image, etc.). If you don't include the print 'Content-type: text/html\n' line that Mike suggests, then your HTML will be swallowed by the system as configuration information (and erroneous information at that).
Mike suggested some webpages to review. It might be good to pour over them to learn more about the CGI protocols. -Arcege-- There's so many different worlds,So many different suns.
And we have just one world,But we live in different ones.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Has anyone tried matplotlib...??

2006-10-22 Thread Matt Richardson
I just used it a couple of weeks ago to produce a histogram of
randomly generated numbers.  Read the documentation, it's well written
and has good examples.

Matt

On 10/22/06, Asrarahmed Kadri [EMAIL PROTECTED] wrote:

 Folks,

 Has anyone tried matplotlib ..//???

 If yes, then is it easy to use...




 --
 To HIM you shall return.
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor





-- 
Matt
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] rabbit core microcontrollers - Django

2006-10-22 Thread Picio
Hello,
I would wonder if anyone knows something about programming Rabbit Core
Modules, that normally were programmed diretctly with Dynamic C, with
Python.
I mean either:
- something like using python to create code in dynamic suitable for
the rabbit core
- writing machine code for the rabbit core using a python API.

Sorry if I'm not using the rights technicals words.

Picio
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] getopt module..

2006-10-22 Thread Asrarahmed Kadri
Can somebody explain getopt function using a simple example..

Thanks..

Regards,

Asrarahmed Kadri-- To HIM you shall return. 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] getopt module..

2006-10-22 Thread David Rock
* Asrarahmed Kadri [EMAIL PROTECTED] [2006-10-22 20:19]:
 Can somebody explain getopt function using a simple example..
 
 Thanks..

This really does have a good example of usage

http://docs.python.org/lib/module-getopt.html

Essentially, you define options and arguments and what you expect to see
from them, then the 

for o, a in opts: 

section is used to replace default values with information from the
commandline.

-- 
David Rock
[EMAIL PROTECTED]
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] 5 questions

2006-10-22 Thread Kent Johnson
Alan Gauld wrote:
 Pine Marten wrote:
 2. Is there list ettiquette one should be aware of?
 
 Yes, but I'm not sure how you get a copy.
 Moderators???

Hmm, I didn't get that as part of my new moderator's welcome package. We 
are pretty informal. The only real rule I can think of is, don't ask us 
to do your homework, and if someone does ask for a homework solution, 
don't give it.

We will *help* with homework if you make an attempt and ask for help.

The best way to ask a question is to make your best attempt at a 
solution and show it. Then we can see where you are stuck. If you get an 
exception traceback from your program, include the entire traceback in 
your post.
 
 3. Besides Vaults of Parnassus, are there other webpages which list 
 projects
 written in Python?  I'm mainly interested in looking at 
 non-technical
 software, things for the common user to use.  I've been surprised at 
 just
 how little of that type I've found so far.
 
 Thee are a few such sites around. The Vaults seem to be falling into
 obsolesece now, although its still my first choice. Others will give 
 you
 their favourites I'm sure.

The Python Package Index AKA the Cheese Shop is the current repository 
of choice:
http://www.python.org/pypi

If there is something specific you are looking for you could ask here or 
google for python plus the specific topic.
 
 4. Can anyone recommend good books for non-programmers starting out 
 learning
 Python?  I've looked through a few so far and they are ok (Learning
 Python, Python: How to Program) but am still hoping to find one 
 that
 doesn't assume any prior knowledge of programming and defines terms 
 when
 they are first presented.  (That might be a tall order, I know...)

Try these two:
http://personalpages.tds.net/~kent37/BookList.html#learning-python

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Has anyone tried matplotlib...??

2006-10-22 Thread Asrarahmed Kadri
Folks,

Has anyone tried matplotlib ..//???

If yes, then is it easy to use...



-- To HIM you shall return. 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Has anyone tried matplotlib...??

2006-10-22 Thread Bill Campbell
On Sun, Oct 22, 2006, Matt Richardson wrote:
I just used it a couple of weeks ago to produce a histogram of
randomly generated numbers.  Read the documentation, it's well written
and has good examples.

You might also want to look at gnuplot.

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:(206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

``If guns are outlawed, only the government will have guns. Only the police,
the secret police, the military, the hired servants of our rulers. Only the
government -- and a few outlaws. I intend to be among the outlaws.''
EDWARD ABBEY (1927-1989)
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] My first real python project: LOLLERSKATES

2006-10-22 Thread Kent Johnson
Tracy R Reed wrote:

 Questions/problems/TODO's:
 
 This is a fairly simple structured programming implementation. No OO.
 Should I be using some classes somewhere?

There doesn't seem to be any need for it.

 
 The config file is just a module which I import which causes all of my
 configs to become globals. Globals are bad. Is there a better way or
 would just about anything else be overkill? A singleton config class or
 something? Overkill?

Instead of
from lollerskates_config import *

try
import lollerskates_config as config

or some other abbreviated name. Then instead of using e.g. 'macros' in 
your program use 'config.macros'. This has the advantage that it is 
clear where macros is defined and the config variables are not global to 
your module.

IMO singletons are greatly overused in general; in Python a module is a 
unique namespace.

 
 I have several loops in this code for processing the logfiles. I once
 tried to convert these for loops to list comprehensions and totally
 confused myself and backed out the change (yeay svn!). Is there any
 benefit to list comprehensions in this case?

I don't see any loops that lend themselves to list comprehensions. A 
list comp is a shorthand way to build a new list from an existing list. 
You don't do that.

 
 I would kinda like to play with unit tests. Not sure how I would
 construct unit tests for this. And again, perhaps overkill. But some
 people tell me you should write the unit tests before you even begin
 coding and code until the tests are satisfied. So even on a small
 project you would have tests. I run into a couple nasty bugs I created
 which caused the script to never return anything from the logfile (so
 you don't immediately realize something is broken) where I thought It
 sure would be nice to have a test to catch that if it ever happens again.

Yep. Have you looked at the unit test module?

Many of your functions are unit-testable though it will be easier if you 
write them so they don't rely on external state (i.e. globals) (this is 
one reason globals are evil).

For example replace_tokens() could be tested, it would be easier if 
macros was a parameter instead of taken from the global state.

process_line() would be easier to test if it didn't rely on the global 
events list, but either took the list as a parameter or returned the 
line or None and let the caller deal with it.

Or maybe you do want a class that can hold the shared state...

One more note:
 if re.match(^$,line):
could just be
if not line:

Overall it looks pretty clean and well-written.
Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] 5 questions

2006-10-22 Thread Luke Paireepinart
Kent Johnson wrote:
 Alan Gauld wrote:
   
 Pine Marten wrote:
 
 2. Is there list ettiquette one should be aware of?
   
 Yes, but I'm not sure how you get a copy.
 Moderators???
 

 Hmm, I didn't get that as part of my new moderator's welcome package. We 
 are pretty informal. The only real rule I can think of is, don't ask us 
 to do your homework, and if someone does ask for a homework solution, 
 don't give it.

 We will *help* with homework if you make an attempt and ask for help.

 The best way to ask a question is to make your best attempt at a 
 solution and show it. Then we can see where you are stuck. If you get an 
 exception traceback from your program, include the entire traceback in 
 your post.
You should've gotten this e-mail when you registered:

Your message for tutor@python.org, the Python programming tutor list,
has been received and is being delivered.  This automated response is
sent to those of you new to the Tutor list, to point out a few
resources that can help with answering your own questions, or improve
the chances of getting a useful answer from the other subscribers.

If your question is something akin to:

I've just heard about Python, and it sounds great!  Where can I
 find out more on how to program with Python?

  or:

 What's Python?

please read section 1 below.

On the other hand, if your question is:
  
I've heard that Python is good for hacking -- I want to know
more!

  or

Can you teach me how to break into a computer with Python?

please read section 2 at the bottom of this email.

Section 1: --

The most comprehensive overview of python.org help resources is at

  http://www.python.org/Help.html

The Python FAQ is available at

  http://www.python.org/doc/FAQ.html 

and it has answers to many questions that people ask, possibly
including your question.  Another wealth of information and experience
can be found via the python.org searches, at

  http://www.python.org/search/

There you'll find comprehensive, easy-to-use searches over the
python.org web site and the Python newsgroup, comp.lang.python.

Python has an online tutorial, available freely from

  http://www.python.org/doc/current/tut/tut.html

Finally, when you do send email to the Tutor list, be as clear as you
can about the problem, including, when relevant, details like:

 - Precise error messages, including complete tracebacks
 - The hardware platform (available in the Python sys module as
sys.platform)
 - The python version (sys.version) 
 - The python search path (sys.path)

In general, be specific about what was going on connected with the
problem or what specific concept you're having difficulties with.  The
better the info you provide, the more likely the helpers will be able
to glean the answer...

There's a HOWTO that shows how to ask smart questions to technical
folks:

http://catb.org/~esr/faqs/smart-questions.html

Although it is provocative, it does have some good points, and is an
interesting read.


Note that no one is paid to read the tutor list or provide answers,
and most readers often have other work that demands their attention.
Well-posed requests for help are usually answered fairly promptly, but
occasionally a request slips by, so if you do not get a response with
one or two working days (it's usually quicker than that), please feel
free to send a followup, asking whether anyone is working on your
question.

Anyway, your message is being delivered to the Tutor list as this one
is being sent.  However, if your question was about as detailed as
Teach me how to program in Python, do not count on an answer -- this
email contains all the information you need to start.  Come back with
a more precise question, and we'll be glad to help.


Thanks!

Section 2: --

We periodically get requests which ask about hacking or cracking or
breaking into computers.  If you haven't yet, go read Eric Raymond's
article How To Become a Hacker at
  http://catb.org/esr/faqs/hacker-howto.html

If, after you've read that, you want help learning how to hack the way
Eric defines the word, then come back to us (and read Section 1
above).  If you want help learning how to crack, go look elsewhere --
we're not interested in helping you do that.





That about sums it up for me :)
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] GUI new project

2006-10-22 Thread Joe Cox
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 codeObject in __main__.__dict__
  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__
Widget.__init__(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
from Tkinter import *

class Application( Frame ):
   def __init__(self):
  Frame.__init__(self)
  self.master.title( Conver Units )

  self.master.rowconfigure( 0, weight = 1 )
  self.master.columnconfigure( 0, weight = 1 )
  self.grid( sticky = W+E+N+S )

  Create the Text
  self.lbRSSSiteText = Label(self, text=Convert Length Units From:)
  self.lbRSSSiteText.grid(row=0, column=0, sticky=W)
  self.lbRSSItemText = Label(self, text=Convert Length Units To:)
  self.lbRSSItemText.grid(row=0, column=2, sticky=W)  

  Create the First ListBox
  scrollbarV = Scrollbar(self, orient=VERTICAL)
  
  self.lbSites = Listbox(self,command=self.reveal, exportselection=0
 , relief=SUNKEN)
  self.lbSites.grid(row=1, column=0, columnspan=1, sticky=N+W+S+E)
  for line in  ['Miles','Yards','Feet','Inches']:
  self.lbSites.insert(END, line)
  
   

  Create the Second ListBox
  
  self.lbRSSItems = Listbox(self, exportselection=0
,command=self.reveal
, relief=SUNKEN)
  self.lbRSSItems.grid(row=1, column=2, sticky=N+W+S+E)
  for line in  ['Miles','Yards','Feet','Inches']:
  self.lbRSSItems.insert(END, line)
  
   

  self.button1 = Button( self, text = Convert, width = 25 )
  self.button1.grid( row = 7, column = 1, columnspan = 2, sticky = W+E+N+S )

  Create the Text
  self.entry = Label(self, text=Input:)
  self.entry.grid(row=8, column=0, sticky=W)
  self.text2 = Label(self, text=Output:)
  self.text2.grid(row=8, column=2, sticky=W)

  self.entry = Entry( self )
  self.entry.grid( row = 11, columnspan = 2, sticky = W+E+N+S )
 

  self.text2 = Text( self, width = 2, height = 2 )
  self.text2.grid( row = 11, column = 2, sticky = W+E+N+S )

   def reveal(self):
   a = self.entry.get()
   b = self.text2.get()
   c = self.lbSites.get(exportselection)
   d = self.lbRSSItems.get(exportselection)
   if c == Miles and d == Feet:
message =Equals+ a*5280
  
   self.text2.insert(0.0,message)  
  
def main():
   Application().mainloop()   

if __name__ == __main__:
   main()
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] GUI new project

2006-10-22 Thread Luke Paireepinart


 
   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@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] GUI new project

2006-10-22 Thread Luke Paireepinart
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 codeObject in __main__.__dict__
   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__
 Widget.__init__(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@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] GUI new project

2006-10-22 Thread Alan Gauld

Joe Cox [EMAIL PROTECTED] 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

Which says that you are using an unknown option command...

ie. Listboxes don't have a command option.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] GUI new project

2006-10-22 Thread johnf
On Sunday 22 October 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@python.org
http://mail.python.org/mailman/listinfo/tutor



Re: [Tutor] GUI new project

2006-10-22 Thread Luke Paireepinart
johnf wrote:
 On Sunday 22 October 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 OP.  Alan had the 
correct answer to the problem.
Listboxes don't take a command argument.

Hope that helps!
-Luke
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor