[Tutor] enter key

2005-04-05 Thread Diana Hawksworth
I am using the tkinter toolkit. Just wish to have the button I have formedreplaced by the Enter key - if possible. Would the raw_input() work, asBernard has suggested, or do I need another piece of code that refers to theEnter key?Thanks. Diana- Original Message - From: "Kent

Re: [Tutor] using the enter key

2005-04-05 Thread Michael Lange
On Tue, 5 Apr 2005 06:28:54 +1000 Diana Hawksworth [EMAIL PROTECTED] wrote: Hello list! At the moment I have some user input tied to a button that allows the input to be submitted and then an answer is supplied. How can I get rid of this submit button, and have the user just press the

Re: [Tutor] using the enter key

2005-04-05 Thread Kent Johnson
Here is a simple example. It is not well structured but it should give you the idea. from Tkinter import * def showText(evt): print 'Text is:', text.get('0.0', END) return 'break' # Prevent the event from propagating to the Text widget root = Tk() text = Text() # This line binds the

[Tutor] Re: one line code

2005-04-05 Thread Andrei
Alan Gauld alan.gauld at freenet.co.uk writes: With other words I'd like to tell Python: Convert into a float if possible, otherwise append anyway. [ (type(x) == type(5) and float(x) or x) for x in mylist ] Almost fell for it too, but the original list contains numbers stored as

Re: [Tutor] one line code

2005-04-05 Thread alan . gauld
This is a perfect opportunity to give the reminder that the conversion functions are also types that can be used more transparently for such Neat I didn't know\ that. How dioes Python equate a function object to a type? Is it hard wired? [(type(x)==int and float(x) or x) for x in l] ['foo',

Re: [Tutor] one line code

2005-04-05 Thread Pierre Barbier de Reuille
[EMAIL PROTECTED] a écrit : This is a perfect opportunity to give the reminder that the conversion functions are also types that can be used more transparently for such Neat I didn't know\ that. How dioes Python equate a function object to a type? Is it hard wired? No, you see it the wrong way

Re: [Tutor] one line code

2005-04-05 Thread Kent Johnson
Pierre Barbier de Reuille wrote: [EMAIL PROTECTED] a écrit : This is a perfect opportunity to give the reminder that the conversion functions are also types that can be used more transparently for such Neat I didn't know\ that. How dioes Python equate a function object to a type? Is it hard

[Tutor] pickle in unicode format

2005-04-05 Thread BRINER Cedric
hi, I have this dictionnary : a={'partition': u'/export/diskH1/home_evol/ricquebo', 'rsmFirstname': u'Fran\xe7ois', 'rsmLastname': u'Ricquebourg', 'size': u'8161222.0', 'size_max': '1'} and I'd like to *serialize* it with pickle and that the output format will be of type unicode.

[Tutor] Py2exe (Joseph Q.)

2005-04-05 Thread Joseph Quigley
Maybe I shouldn't be posting this... I downloaded py2exe and can't get it to make exe's of my python files. There are a list of instructions: # A very simple setup script to create 2 executables. # # hello.py is a simple hello, world type program, which alse allows # to explore the environment

Re: [Tutor] one line code

2005-04-05 Thread Gregor Lingl
Pierre Barbier de Reuille schrieb: Mmmhhh ... not strictly one line but ... import re float_str = re.compile(r^\s*[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?\s*$) val = [ ( (float_str.match(s) and [float(s)]) or [s])[0] for s in l2 ] It's not really readable but well ... it works ^_^ Pierre This can

Re: [Tutor] [HELP]how to test properties of a file

2005-04-05 Thread Bernard Lebel
As far as I'm aware, this is very normal. The file is being used by an application, so there is a lock on it. Cheers Bernard On Apr 4, 2005 7:34 PM, Shidai Liu [EMAIL PROTECTED] wrote: I found out in the following situation, it fails to work. Say, 'somefile.csv' is opened by EXCEL,

Re: [Tutor] pickle in unicode format

2005-04-05 Thread Kent Johnson
BRINER Cedric wrote: hi, I have this dictionnary : a={'partition': u'/export/diskH1/home_evol/ricquebo', 'rsmFirstname': u'Fran\xe7ois', 'rsmLastname': u'Ricquebourg', 'size': u'8161222.0', 'size_max': '1'} and I'd like to *serialize* it with pickle and that the output format will be of type

[Tutor] Calendar question

2005-04-05 Thread John Carmona
I am back, thanks again all to help me sorting out the High_Low guessing game using time. Can somebody put me on the right track for the following script. I know how to use the calendar.prcal command to print the 12 months of choosen year. But how do you use the prmonth command, if you, for

[Tutor] Py2exe (Joseph Q.)

2005-04-05 Thread Joseph Quigley
Joseph Q. (Uspantan, Guatemala) Using Python 2.4 I downloaded py2exe and can't get it to make exe's of my python files. There are a list of instructions: # A very simple setup script to create 2 executables. # # hello.py is a simple hello, world type program, which alse allows # to explore the

Re: [Tutor] Calendar question

2005-04-05 Thread Kristian Zoerhoff
On Apr 5, 2005 11:26 AM, John Carmona [EMAIL PROTECTED] wrote: But how do you use the prmonth command, if you, for example, want to write something asking you: to enter a year (this I know) to enter a month of that year and print just the month import calendar year = int(raw_input(Year?

Re: [Tutor] Calendar question

2005-04-05 Thread John Carmona
Thanks Kristian, it works a treat. Now you have set me up with finding out how to use the months entered by name. If I am stuck I will post again. Thanks very much JC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] pickle in unicode format

2005-04-05 Thread Kent Johnson
Kent Johnson wrote: BRINER Cedric wrote: unicode(pickle.dumps(a)) doesn't work ! pickle.dumps() doesn't return a value, it puts the data into 'a' which must be a file-like object. Oops, pickle.dumps() does return a value and the parameter is the object to be pickled. I even knew that before I

Re: [Tutor] [HELP]how to test properties of a file

2005-04-05 Thread Nick Lunt
Shidai Liu wrote: I found out in the following situation, it fails to work. Say, 'somefile.csv' is opened by EXCEL, os.access('somefile.csv', os.W_OK) True file('somefile.csv', 'w') IOError: [Errno 13] Permission denied: 'somefile.csv' By the way, using os.stat stat

Re: [Tutor] pickle in unicode format

2005-04-05 Thread Danny Yoo
I have this dictionnary : a={'partition': u'/export/diskH1/home_evol/ricquebo', 'rsmFirstname': u'Fran\xe7ois', 'rsmLastname': u'Ricquebourg', 'size': u'8161222.0', 'size_max': '1'} and I'd like to *serialize* it with pickle and that the output format will be of type

Re: [Tutor] pickle in unicode format

2005-04-05 Thread Danny Yoo
Are you trying to send it off to someone else as a part of an XML document? If you are including some byte string into an XML document, you can encode those bytes as base64: ## bytes = 'Fran\xe7ois' encodedBytes = bytes.encode('base64') encodedBytes 'RnJhbudvaXM=\n' ##

Re: [Tutor] Calendar question

2005-04-05 Thread John Carmona
Kristian you wrote: - This assumes all input as integers; if you want months entered by name, you'll have to write a conversion routine (hint: use a dict).

[Tutor] Mouseclick

2005-04-05 Thread Øyvind
I am creating a little application that demonstrates some tasks on the screen for the user, but cannot seem to click the left mousebutton. I have moved the cursor to the correct position by from ctypes import * windll.user32.SetCursorPos(100, 400) and would like to click the left mousebutton

Fwd: [Tutor] Calendar question

2005-04-05 Thread Kristian Zoerhoff
Forgot to Reply-All. Dagnabbit. -- Forwarded message -- From: Kristian Zoerhoff [EMAIL PROTECTED] Date: Apr 5, 2005 3:33 PM Subject: Re: [Tutor] Calendar question To: John Carmona [EMAIL PROTECTED] On Apr 5, 2005 3:08 PM, John Carmona [EMAIL PROTECTED] wrote: Kristian you

[Tutor] Re: Calendar question

2005-04-05 Thread Roel Schroeven
John Carmona wrote: Kristian you wrote: - This assumes all input as integers; if you want months entered by name, you'll have to write a conversion routine (hint: use a dict).

Re: [Tutor] Major Newbie Here

2005-04-05 Thread Kristian Zoerhoff
On Apr 5, 2005 2:49 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello all, I'm a cell biologist that is learning python. I've been following Alan Gauld's tutorial online and I've hit a wall. I'm typing class Spam: A meat for combining with other foods It can be

Re: [Tutor] Major Newbie Here

2005-04-05 Thread Danny Yoo
I'm a cell biologist that is learning python. I've been following Alan Gauld's tutorial online and I've hit a wall. I'm typing class Spam: A meat for combining with other foods It can be used with other foods to make interesting meals. It comes with lots of nutrients

[Tutor] Re: Major Newbie Here

2005-04-05 Thread Roel Schroeven
[EMAIL PROTECTED] wrote: Hello all, I'm a cell biologist that is learning python. I've been following Alan Gauld's tutorial online and I've hit a wall. I'm typing class Spam: A meat for combining with other foods It can be used with other foods to make interesting meals.

[Tutor] Re: Script (Python) for Zope

2005-04-05 Thread Lee Harr
Hello, I am looking for a Python-script for Zope which counts the objects (files) in the current folder and all its subfolders, but I don't know how to implement this script. Can somebody help me, please? Or ist there a newsgroup/mailing list which can help me to find a solution for this problem?

Re: [Tutor] Re: random import errors

2005-04-05 Thread Jay Loden
Only one version installed, and I could copy it over from elsewhere, but I wouldn't be inclined to do so since it works right now. -Jay On Tuesday 05 April 2005 10:22 pm, Lee Harr wrote: I have a python script that runs on my webserver every fifteen minutes. It has run for several months

Re: [Tutor] Major Newbie Here

2005-04-05 Thread jfouhy
Quoting Danny Yoo [EMAIL PROTECTED]: Try: ## class Spam: A meat for combining with other foods It can be used with other foods to make interesting meals. It comes with lots of nutrients and can be cooked using many different techniques def__init__(self): ## ... rest of code

Re: [Tutor] [HELP]how to test properties of a file

2005-04-05 Thread Shidai Liu
On Apr 5, 2005 6:33 PM, Nick Lunt [EMAIL PROTECTED] wrote: I havent got access to a windows box unfortunately at the moment. And I have no idea about permissions on windows boxes anyway :) However, did you already have the .csv file open in Excel or some other app ? Or is is password protected

Re: [Tutor] [HELP]how to test properties of a file

2005-04-05 Thread Shidai Liu
On Apr 5, 2005 3:40 PM, Bernard Lebel [EMAIL PROTECTED] wrote: As far as I'm aware, this is very normal. The file is being used by an application, so there is a lock on it. However, os.access('somefile.csv', os.W_OK) returns True. Shouldn't it return False?

Re: [Tutor] Py2exe (Joseph Q.)

2005-04-05 Thread Chad Crabtree
The symptoms you explain mean you don't have py2exe installed correctly. Try uninstalling it and reinstalling it. Joseph Quigley wrote: Joseph Q. (Uspantan, Guatemala) Using Python 2.4 I downloaded py2exe and can't get it to make exe's of my python files. There are a list of

Re: [Tutor] Calendar question

2005-04-05 Thread Jacob S.
Also, I have been looking for some exercises to do using Python, obviously (and unfortunately) they need to be at a beginner level. Or better if anyone wants to send me one to do I would be very grateful I know a few exercises -- those that I have done. Some are beginner, some are difficult.

Re: [Tutor] Py2exe (Joseph Q.)

2005-04-05 Thread Jacob S.
Type this into the interpreter and post the results - copy and pasted, not hand typed. import sys for x in sys.path: print x## This is indented It should give you a list of paths -- these are all of the paths that python looks for modules in. My guess is that you don't have the

Re: [Tutor] Re: If elif not working in comparison

2005-04-05 Thread gerardo arnaez
Hi all. I would like some crituqe on this code. It is three separate files (all put on one web page) Each one is labeled in the comment that begins each section of code. It is a little longer when I put it all on one page, so I have it up on a link. If any kind souls would critique it before I

[Tutor] Birthday Book

2005-04-05 Thread Kedar Tangudu
Hi I am building a birthday book for myself and would appreciate some quick help from you. Just click on the link below and enter your birthday details. It's easy and you can keep your age secret!... http://www.BirthdayAlarm.com/bd1/38729335a575244353b530591538c915052256d1386 Thanks

Re: [Tutor] Re: If elif not working in comparison

2005-04-05 Thread Brian van den Broek
gerardo arnaez said unto the world upon 2005-04-05 23:00: Hi all. I would like some crituqe on this code. It is three separate files (all put on one web page) Each one is labeled in the comment that begins each section of code. It is a little longer when I put it all on one page, so I have it up