[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 fu

[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 co

Re: [Tutor] Object Management

2011-07-27 Thread James Reynolds
On Wed, Jul 27, 2011 at 9:51 AM, 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 exampl

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 sa

Re: [Tutor] Getting Idle to work in Win7

2011-07-27 Thread Walter Prins
Hi On 27 July 2011 22:07, Wayne Watson 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 > select IDLE, the same th

[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 completion,

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 using

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 c

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 thi

Re: [Tutor] Object Management

2011-07-27 Thread Alexander
On Tue, Jul 26, 2011 at 6:25 PM, Alan Gauld wrote: > 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 t

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 mai

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 w

Re: [Tutor] Fall in love with bpython

2011-07-27 Thread Walter Prins
Hi Karim On 28 July 2011 00:04, Karim 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 MacOS

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 > 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

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 argume

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 so

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', 'TAG

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 wrote: > 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 as

Re: [Tutor] Assigning range :p:

2011-07-27 Thread Thomas C. Hicks
On Wed, 27 Jul 2011 20:16:31 -0400 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 t

[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: nuke.thisNode().

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. Fl

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 wrote: > 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 l

[Tutor] python Module for Windows Active Directory

2011-07-27 Thread qbits143
Hi, Which is the best package/module in Python to work with Windows Active Directory? I may need to create multiple OUs, set different users and computers and fill their individual attributes. Later i may need to modify/delete and then may need to check them for its availability.   Thanks in Advanc