Re: [Tutor] output sequentially

2011-07-27 Thread Peter Otten
lina wrote: I have below file, I wish the output following: The first field 169 -170 sequential, and then the filed 2 from 1-29, ignore the rest 4 fields, 169CHOL O28 1612 6.966 6.060 6.429 Read the lines from the file, sort them with a proper key function, write the

[Tutor] Python Tkinter event activated with time

2011-07-27 Thread Emeka
Hello All, I am putting together a small game, and I would want to enable my callback function using time passed. How to do something like this with Tkinter event. from time import time ftime = time() if ftime - time() 2000: dosomething -- *Satajanus Nig. Ltd *

Re: [Tutor] Python Tkinter event activated with time

2011-07-27 Thread Peter Otten
Emeka wrote: I am putting together a small game, and I would want to enable my callback function using time passed. How to do something like this with Tkinter event. from time import time ftime = time() if ftime - time() 2000: dosomething You can schedule a function

[Tutor] Object Management

2011-07-27 Thread Alexander
Hello everyone. I'm having trouble wrapping my mind around a project I'm working on. My goal is to create a program that manages (allows its users to manipulate, search by criteria and edit) objects. There is one type of object, for example I'll say it's a car. There will be a central data file

Re: [Tutor] Object Management

2011-07-27 Thread James Reynolds
On Wed, Jul 27, 2011 at 9:51 AM, Alexander rhettna...@gmail.com wrote: Hello everyone. I'm having trouble wrapping my mind around a project I'm working on. My goal is to create a program that manages (allows its users to manipulate, search by criteria and edit) objects. There is one type of

Re: [Tutor] Object Management

2011-07-27 Thread Knacktus
Am 27.07.2011 15:51, schrieb Alexander: Hello everyone. I'm having trouble wrapping my mind around a project I'm working on. My goal is to create a program that manages (allows its users to manipulate, search by criteria and edit) objects. There is one type of object, for example I'll say it's a

[Tutor] shlex parsing

2011-07-27 Thread Karim
Hello All, I would like to parse this TCL command line with shlex: '-option1 [get_rule A1 B2] -option2 $VAR -option3 TAG' And I want to get the splitted list: ['-option1', '[get_rule A1 B2]', '-option2', '$VAR', '-option3', 'TAG'] Then I will gather in tuple 2 by 2 the arguments. I tried

Re: [Tutor] shlex parsing

2011-07-27 Thread Karim
Thank you Dan for answering. I ended with this and gave up with shlex: split = ['-option1', '[get_rule', 'A1', 'B2]', '-option2', '$VAR', '-option3', 'TAG'] procedure_found = False result = [] for token in split: if not token.startswith('[') and not token.endswith(']') and not

[Tutor] Getting Idle to work in Win7

2011-07-27 Thread Wayne Watson
It's been many months since I played with Python, and have forgotten how to bring up IDLE. If I simply click on a py file, I see what may be a dos window appear and quickly disappear. If I right-click on the file, and select IDLE, the same thing happens. If I go directly to All Programs, the

Re: [Tutor] Getting Idle to work in Win7

2011-07-27 Thread Walter Prins
Hi On 27 July 2011 22:07, Wayne Watson sierra_mtnv...@sbcglobal.net wrote: It's been many months since I played with Python, and have forgotten how to bring up IDLE. If I simply click on a py file, I see what may be a dos window appear and quickly disappear. If I right-click on the file, and

[Tutor] Fall in love with bpython

2011-07-27 Thread Karim
Hello, I use bpython interpreter. This is a very good interactive CLI. I want to create a CLI with the same features than bpython. But the cmd std module seems no to be used in this project... Is there a tool where I can plug all my grammary commands line a sort of generic box with

Re: [Tutor] shlex parsing

2011-07-27 Thread Karim
On 07/28/2011 12:11 AM, Dan Stromberg wrote: You could probably use a recursive descent parser with the standard library. But if your management is OK with pyparsing, that might be easier, and a bit more clear as well. Yes, I thought to use str method partition in a recursive way but

Re: [Tutor] Object Management

2011-07-27 Thread Alan Gauld
Alexander wrote: Hello everyone. I'm having trouble wrapping my mind around a project I'm working on. My goal is to create a program that manages (allows its users to manipulate, search by criteria and edit) objects. There is one type of object, for example I'll say it's a car. There will be a

Re: [Tutor] Fall in love with bpython

2011-07-27 Thread Alan Gauld
Karim wrote: I use bpython interpreter. This is a very good interactive CLI. I had never heard of it and had to google for it. It appears to be a curses based CLI for *nix and MacOS I want to create a CLI with the same features than bpython. But the cmd std module seems no to be used in

Re: [Tutor] Object Management

2011-07-27 Thread Alexander
On Tue, Jul 26, 2011 at 6:25 PM, Alan Gauld alan.ga...@btinternet.comwrote: Alexander wrote: Hello everyone. I'm having trouble wrapping my mind around a project I'm working on. My goal is to create a program that manages (allows its users to manipulate, search by criteria and edit)

Re: [Tutor] Getting Idle to work in Win7

2011-07-27 Thread Prasad, Ramit
From: tutor-bounces+ramit.prasad=jpmchase@python.org [mailto:tutor-bounces+ramit.prasad=jpmchase@python.org] On Behalf Of Walter Prins Sent: Wednesday, July 27, 2011 4:39 PM To: tutor@python.org Subject: Re: [Tutor] Getting Idle to work in Win7 Hi On 27 July 2011 22:07, Wayne Watson

Re: [Tutor] Fall in love with bpython

2011-07-27 Thread Karim
On 07/27/2011 12:34 AM, Alan Gauld wrote: Karim wrote: I use bpython interpreter. This is a very good interactive CLI. I had never heard of it and had to google for it. It appears to be a curses based CLI for *nix and MacOS Ah Windows user. I want to create a CLI with the same features

Re: [Tutor] Fall in love with bpython

2011-07-27 Thread Karim
On 07/28/2011 12:31 AM, Michael Poeltl wrote: hi, have you heard abut ipython? maybe that's helpful for you? http://ipython.scipy.org/moin/python Hello Michael, Yes I saw some article where Ipython and Bpython CLI integrations was made in Django. Thanks for the link I will evaluate it as

Re: [Tutor] Fall in love with bpython

2011-07-27 Thread Walter Prins
Hi Karim On 28 July 2011 00:04, Karim karim.liat...@free.fr wrote: On 07/27/2011 12:34 AM, Alan Gauld wrote: Karim wrote: I use bpython interpreter. This is a very good interactive CLI. I had never heard of it and had to google for it. It appears to be a curses based CLI for *nix and

Re: [Tutor] Fall in love with bpython

2011-07-27 Thread Karim
On 07/28/2011 01:32 AM, Walter Prins wrote: Hi Karim On 28 July 2011 00:04, Karim karim.liat...@free.fr mailto:karim.liat...@free.fr wrote: On 07/27/2011 12:34 AM, Alan Gauld wrote: Karim wrote: I use bpython interpreter. This is a very good interactive

Re: [Tutor] Object Management

2011-07-27 Thread Steven D'Aprano
Alexander wrote: Hello everyone. I'm having trouble wrapping my mind around a project I'm working on. My goal is to create a program that manages (allows its users to manipulate, search by criteria and edit) objects. There is one type of object, for example I'll say it's a car. This is called

[Tutor] Assigning range

2011-07-27 Thread Alexander Quest
Does anyone know how to assign a certain numerical range to a variable, and then choose the number that is the middle of that range? For example, I want to assign the variable X a range between 1 and 50, and then I want to have the middle of that range (25) return with some command when I call it

Re: [Tutor] shlex parsing

2011-07-27 Thread Steven D'Aprano
Karim wrote: Hello All, I would like to parse this TCL command line with shlex: '-option1 [get_rule A1 B2] -option2 $VAR -option3 TAG' And I want to get the splitted list: ['-option1', '[get_rule A1 B2]', '-option2', '$VAR', '-option3', 'TAG'] Then I will gather in tuple 2 by 2 the

Re: [Tutor] Assigning range

2011-07-27 Thread Steven D'Aprano
Alexander Quest wrote: Does anyone know how to assign a certain numerical range to a variable, and then choose the number that is the middle of that range? For example, I want to assign the variable X a range between 1 and 50, and then I want to have the middle of that range (25) return with

Re: [Tutor] shlex parsing

2011-07-27 Thread Karim
On 07/28/2011 02:27 AM, Steven D'Aprano wrote: Karim wrote: Hello All, I would like to parse this TCL command line with shlex: '-option1 [get_rule A1 B2] -option2 $VAR -option3 TAG' And I want to get the splitted list: ['-option1', '[get_rule A1 B2]', '-option2', '$VAR', '-option3',

Re: [Tutor] Assigning range

2011-07-27 Thread Alexander Quest
Thanks Steven- I'll try that out. -Alex On Wed, Jul 27, 2011 at 5:40 PM, Steven D'Aprano st...@pearwood.infowrote: Alexander Quest wrote: Does anyone know how to assign a certain numerical range to a variable, and then choose the number that is the middle of that range? For example, I

Re: [Tutor] Assigning range :p:

2011-07-27 Thread Thomas C. Hicks
On Wed, 27 Jul 2011 20:16:31 -0400 Alexander Quest alexxqu...@gmail.com wrote: Does anyone know how to assign a certain numerical range to a variable, and then choose the number that is the middle of that range? For example, I want to assign the variable X a range between 1 and 50, and then I

[Tutor] how to temporarily disable a function

2011-07-27 Thread Pete O'Connell
Hi I was wondering if there is a way to disable a function. Hi have a GUI grid snapping function that I use in a program called Nuke (the film compositing software) Here is the function (which loads when Nuke loads): ### def theAutoplaceSnap(): try:

Re: [Tutor] Assigning range

2011-07-27 Thread Donald Wilson
You could start with an anonymous function using the lambda operator, such as: mid_range = lambda x: x[len(x) // 2] Note: If you use len(x) / 2 in python 3.x you will get a TypeError because the division operator / returns a float.

Re: [Tutor] Assigning range

2011-07-27 Thread Alexander Quest
Thanks for that Donald! -Alex On Wed, Jul 27, 2011 at 8:16 PM, Donald Wilson donald...@me.com wrote: You could start with an anonymous function using the lambda operator, such as: mid_range = lambda x: x[len(x) // 2] Note: If