Re: How to get current module object

2008-02-17 Thread Gabriel Genellina
En Sun, 17 Feb 2008 16:25:44 -0200, Alex <[EMAIL PROTECTED]> escribi�: > Can I get reference to module object of current module (from which the > code is currently executed)? I know __import__('filename') should > probably do that, but the call contains redundant information (filename, > which nee

Re: Python Memory Manager

2008-02-17 Thread greg
Christian Heimes wrote: > In release builds PyObject_HEAD only contains the ref count and a link > to the object type. In Py_DEBUG builds it also contains a double linked > list of all allocated objects to debug reference counting bugs. There's also a doubly-linked list used by the cycle detector,

Re: Python Memory Manager

2008-02-17 Thread greg
Paul Rubin wrote: > As I understand it, Python primarily uses reference counting, with a > mark and sweep scheme for cycle breaking tacked on as an afterthought. It's not mark-and-sweep, it's a cycle detector. It goes through all allocated objects of certain types, and all objects reachable from

Re: How about adding rational fraction to Python?

2008-02-17 Thread Carl Banks
On Feb 17, 1:45 pm, Lie <[EMAIL PROTECTED]> wrote: > > Any iteration with repeated divisions and additions can thus run the > > denominators up. This sort of calculation is pretty common (examples: > > compound interest, numerical integration). > > Wrong. Addition and subtraction would only grow t

Re: CSV module: incorrectly parsed file.

2008-02-17 Thread Steve Holden
7stud wrote: > On Feb 17, 9:11 pm, 7stud <[EMAIL PROTECTED]> wrote: >> On Feb 17, 7:09 pm, Christopher Barrington-Leigh >> >> >> >> <[EMAIL PROTECTED]> wrote: >>> Here is a file "test.csv" >>> number,name,description,value >>> 1,"wer","tape 2"",5 >>> 1,vvv,"hoohaa",2 >>> I want to convert it to tab

Re: Solve a Debate

2008-02-17 Thread greg
Wolfgang Draxinger wrote: > Somehow you seem to think, that a lookup table will require more > resources (memory I guess you thought) than a sequence of > comparisons. However you didn't take into account, that the > program code itself requires memory, too (for the operation > codes). In Python,

Re: CSV module: incorrectly parsed file.

2008-02-17 Thread 7stud
On Feb 17, 9:11 pm, 7stud <[EMAIL PROTECTED]> wrote: > On Feb 17, 7:09 pm, Christopher Barrington-Leigh > > > > <[EMAIL PROTECTED]> wrote: > > Here is a file "test.csv" > > number,name,description,value > > 1,"wer","tape 2"",5 > > 1,vvv,"hoohaa",2 > > > I want to convert it to tab-separated without

Re: Pop-up Menu of a Graphics Image?

2008-02-17 Thread W. Watson
Thanks. I'm just getting started in Python, so probably don't want to go far off the main stream. Don't see Misc. I see things like Presentations, Search this site, ... Mike Driscoll wrote: > On Feb 15, 2:28 pm, "W. Watson" <[EMAIL PROTECTED]> wrote: >> I want to allow a user who is looking at a

Re: Pmw Use and Grayson's Book

2008-02-17 Thread W. Watson
I wonder why he uses it? If I want to run his examples, where do I put the lib he includes? Same folder as the example? Mike Driscoll wrote: > On Feb 17, 9:33 pm, "W. Watson" <[EMAIL PROTECTED]> wrote: >> I don't have Grayson's Tkinter book, but I see he uses something called Pmw. >> Why is it

Re: CSV module: incorrectly parsed file.

2008-02-17 Thread 7stud
On Feb 17, 7:09 pm, Christopher Barrington-Leigh <[EMAIL PROTECTED]> wrote: > Here is a file "test.csv" > number,name,description,value > 1,"wer","tape 2"",5 > 1,vvv,"hoohaa",2 > > I want to convert it to tab-separated without those silly quotes. Note > in the second line that a field is 'tape 2"'

Re: Pmw Use and Grayson's Book

2008-02-17 Thread Mike Driscoll
On Feb 17, 9:33 pm, "W. Watson" <[EMAIL PROTECTED]> wrote: > I don't have Grayson's Tkinter book, but I see he uses something called Pmw. > Why is it needed with Tkinter? > -- > Wayne Watson (Nevada City, CA) > > Web Page: It's not needed. It's

Re: Cleaning Up an Application When the Window is Closed

2008-02-17 Thread W. Watson
Good. Thanks. Mike Driscoll wrote: > On Feb 17, 8:31 pm, "W. Watson" <[EMAIL PROTECTED]> wrote: >> Suppose I write some Win XP application using the Tkinter GUI, and do not >> provide a mechanism to exit other than the user clicking on the X in the >> upper right corner of a window. Is there a mec

Pmw Use and Grayson's Book

2008-02-17 Thread W. Watson
I don't have Grayson's Tkinter book, but I see he uses something called Pmw. Why is it needed with Tkinter? -- Wayne Watson (Nevada City, CA) Web Page: -- http://mail.python.org/mailman/listinfo/python-list

Re: Cleaning Up an Application When the Window is Closed

2008-02-17 Thread Mike Driscoll
On Feb 17, 8:31 pm, "W. Watson" <[EMAIL PROTECTED]> wrote: > Suppose I write some Win XP application using the Tkinter GUI, and do not > provide a mechanism to exit other than the user clicking on the X in the > upper right corner of a window. Is there a mechanism that will allow me to > put up an

Help! pty interact with bash

2008-02-17 Thread est
#!/usr/bin/env python import os, pty, time class pty_Popen: def __init__ (self, command, *args): self.pid, self.fd = pty.fork () if self.pid == 0: os.execv (command, command, args) else: pass def read (self, max_read): return os.read

Re: CSV module: incorrectly parsed file.

2008-02-17 Thread Paul McGuire
On Feb 17, 8:09 pm, Christopher Barrington-Leigh <[EMAIL PROTECTED]> wrote: > Here is a file "test.csv" > number,name,description,value > 1,"wer","tape 2"",5 > 1,vvv,"hoohaa",2 > > I want to convert it to tab-separated without those silly quotes. Note > in the second line that a field is 'tape 2"'

Cleaning Up an Application When the Window is Closed

2008-02-17 Thread W. Watson
Suppose I write some Win XP application using the Tkinter GUI, and do not provide a mechanism to exit other than the user clicking on the X in the upper right corner of a window. Is there a mechanism that will allow me to put up an save-dialog to give the user the option to save his present stat

Re: CSV module: incorrectly parsed file.

2008-02-17 Thread Andrew McNamara
>Here is a file "test.csv" >number,name,description,value >1,"wer","tape 2"",5 >1,vvv,"hoohaa",2 > >I want to convert it to tab-separated without those silly quotes. Note >in the second line that a field is 'tape 2"' , ie two inches: there is >a double quote in the string. The input format is ambi

Re: Solve a Debate

2008-02-17 Thread castironpi
> What shall there be missing? breaks? You noticed, that I defined > some artificial architecture on purpose. "days_in_month 12:" > tells it, that the next 12 blurps are tabular data, that can be > indexed. If the "interpreter" hits the line "days_in_month 12:" > it will unconditionally jump 12 ins

CSV module: incorrectly parsed file.

2008-02-17 Thread Christopher Barrington-Leigh
Here is a file "test.csv" number,name,description,value 1,"wer","tape 2"",5 1,vvv,"hoohaa",2 I want to convert it to tab-separated without those silly quotes. Note in the second line that a field is 'tape 2"' , ie two inches: there is a double quote in the string. When I use csv module to read th

Re: Tkinter Confusion

2008-02-17 Thread 7stud
[EMAIL PROTECTED] wrote: > Do I use > Tk() or toplevel()? (Support for both and if a cogent explanation of > the differences exists, I didn't find it.) > If you close the window created by Tk(), the program terminates. If you close a window created by Toplevel() only that window closes. The Tk()

Re: Tkinter Confusion

2008-02-17 Thread 7stud
On Feb 17, 12:36 pm, [EMAIL PROTECTED] wrote: > Everything I've read about Tkinter says you create your window and > then call its mainloop() method. But that's not really true. This is > enough to launch a default window from the console: > > >>>from Tkinter import * > >>>foo = Tk() > You shouldn

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-17 Thread JussiJ
On Feb 14, 5:54 pm, "W. Watson" <[EMAIL PROTECTED]> wrote: > See Subject. It's a simple txt file, each line is a Python stmt, > but I need up to four digits added to each line with a space > between the number field and the text. FWIW here is a Zeus editor, Python macro script to do this: im

Developing a Package with Sub Packages

2008-02-17 Thread Josh English
I have created a group of scripts to manage an XML-based database. I'd like to make it into a proper package that will let me keep track of the code. I have a lot of files that are similar in name and they just get crowded in one folder. Here's a sample of the file structure: IMS/ IMS/__init__.py

Re: Tkinter Confusion

2008-02-17 Thread Marc 'BlackJack' Rintsch
On Sun, 17 Feb 2008 11:36:25 -0800, MartinRinehart wrote: > Everything I've read about Tkinter says you create your window and > then call its mainloop() method. But that's not really true. This is > enough to launch a default window from the console: > from Tkinter import * foo = Tk() D

Re: Dont know what my class is called...

2008-02-17 Thread Ben Finney
"Adam W." <[EMAIL PROTECTED]> writes: > I am using the xml.sax package, and I'm running into a little > problem. When I use the parse(url, ContentHandler()) method, I don't > know what parse() is naming the instance of ContentHandler. I'm not sure what you're asking. Why do you need to know the

Re: Dont know what my class is called...

2008-02-17 Thread Adam W.
On Feb 17, 6:12 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > It's a bit hard to get what you are after, but maybe this solves your > problem? > > handler = FeedHandler() > > parse(handler) > > print handler.my_instance_variable_of_choice > > The above assumes that my_instance_variable_of_cho

How to do a callback from externally triggered event

2008-02-17 Thread John Stevens
I am using PIL to make images that I need to display in a sequence. The image needs to change when a an event happens from a serial port. I call the following function to display the image, but then the application is waiting for an event. I need to return to the main code which is sending comma

Re: Dont know what my class is called...

2008-02-17 Thread Diez B. Roggisch
Adam W. schrieb: > I am using the xml.sax package, and I'm running into a little > problem. When I use the parse(url, ContentHandler()) method, I don't > know what parse() is naming the instance of ContentHandler. > > I have a sub-class of ContentHandler make a dictionary of what it > parses, but

Dont know what my class is called...

2008-02-17 Thread Adam W.
I am using the xml.sax package, and I'm running into a little problem. When I use the parse(url, ContentHandler()) method, I don't know what parse() is naming the instance of ContentHandler. I have a sub-class of ContentHandler make a dictionary of what it parses, but the problem is I don't know

Re: sockets -- basic udp client

2008-02-17 Thread 7stud
On Feb 17, 12:15 pm, [EMAIL PROTECTED] (Douglas Wells) wrote: > > For example: > > > import socket, sys > > > host =  'localhost'  #sys.argv[1] > > port = 3300 > > s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) > > > s.settimeout(1.0) > > buf = '' > > > data = 'hello world' > > num_sent = 0 >

Re: Solve a Debate

2008-02-17 Thread Wolfgang Draxinger
[EMAIL PROTECTED] wrote: >> days_in_month 12: >> 31 >> 30 >> 28 >> 31 >> ... >> 30 >> 31 >> assign $days days_in_month[$month] > > This is missing > days_in_month 12: > 31 > break > 30 > break What shall there be missing? breaks? You noticed, that I defined some artificial architecture on purpos

Re: Solve a Debate

2008-02-17 Thread castironpi
> days_in_month 12: > 31 > 30 > 28 > 31 > ... > 30 > 31 > assign $days days_in_month[$month] This is missing days_in_month 12: 31 break 30 break Or the addition add $x' $x offset store $r0 $x' assign $days $r0 Is that 4 ticks or 5; or 24 blips? -- http://mail.python.org/mailman/listinfo/python-

Re: Just for fun: Countdown numbers game solver

2008-02-17 Thread wolfram . hinderer
On 22 Jan., 23:56, [EMAIL PROTECTED] wrote: > So anyone got an answer to which set of numbers gives the most targets > from 100 onwards say (or from 0 onwards)? IsPythonupto the task? It's (5, 8, 9, 50, 75, 100): 47561 targets altogether (including negative ones), 25814 targets >= 100. (BTW, 1226

Re: Tkinter Confusion

2008-02-17 Thread Sam Garson
I'm just a beginner, but I think I understand some of this: The mainloop is not there to build the window, it is there to check for events, i.e. continually refresh all the widgets. Without, any events you bind will not be detected. Tk() is the first window you make, any after that are toplevel()s.

Re: XML pickle

2008-02-17 Thread castironpi
> > Which xmlns:ns1 gets "redefined" because I just didn't figure out how > > get xmlns:ns0 definition into the Workbook tag. But too bad for me. > > What about actually *reading* the links I post? > > http://codespeak.net/lxml/tutorial.html#the-e-factory > > Hint: look out for the "nsmap" keyword

Re: Python Memory Manager

2008-02-17 Thread Paul Rubin
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > That's not exactly true, i.e. it isn't mark-and-sweep, but some similar > scheme that allows incremental collection without write barriers. This > particular scheme heavily relies on refcounting itself (specifically, > an object is garbage in a certai

Re: Python Memory Manager

2008-02-17 Thread Martin v. Löwis
>> Also, if it does, how does it deal with memory segmentation? This >> question bothers me because I've been trying to implement a moving >> garbage collector, and am not sure how to deal with updating all >> program pointers to objects on the heap, and thought perhaps an answer >> to this questio

Re: Python Memory Manager

2008-02-17 Thread thebjorn
On Feb 17, 10:01 pm, Pie Squared <[EMAIL PROTECTED]> wrote: [...] > It seems to me that another, perhaps better strategy, would be to > allocate a large heap space, then store a pointer to the base of the > heap, the current heap size, and the beginning of the free memory. > When you need to 'alloc

Re: Python Memory Manager

2008-02-17 Thread Paul Rubin
Pie Squared <[EMAIL PROTECTED]> writes: > It seems to me that another, perhaps better strategy, would be to > allocate a large heap space, then store a pointer to the base of the > heap, the current heap size, and the beginning of the free memory. > When you need to 'allocate' more room, just retur

Re: Linux/Python Issues

2008-02-17 Thread [EMAIL PROTECTED]
On 17 fév, 20:38, [EMAIL PROTECTED] wrote: (snip) > What's not in the instructions is what directory should I be in when I > download? Where should I put the ".bz2" file? What dir for running the > make files? Neither are the basic shell commands like cd, tar etc. Nothing Python- specific here, an

Re: Python Memory Manager

2008-02-17 Thread Pie Squared
On Feb 17, 3:05 pm, [EMAIL PROTECTED] wrote: > I researched this for some Java I wrote. Try to avoid shuffling > physical memory - you'll write a lot less code and it will be faster, > too. > > Use an "allocated" list and an "available" list. Keep them in address > order. Inserting (moving list ele

Re: Python Memory Manager

2008-02-17 Thread Christian Heimes
Pie Squared wrote: > I've been looking at the Python source code recently, more > specifically trying to figure out how it's garbage collector works. > > I've gathered that it uses refcounting as well as some cycle-detection > algorithms, but I haven't been able to figure out some other things. P

Re: Linux/Python Issues

2008-02-17 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > I went to Python.org, DL'd Python 2.5 source code per the usual > inadequate instructions and ran the make files successfully (sort of). > Python 2.5 works fine. But "from Tkinter import *" gets a "What's > Tkinter?" message. IDLE's no where to be found. > > What's not

Re: How to get current module object

2008-02-17 Thread John Machin
On Feb 18, 5:25 am, Alex <[EMAIL PROTECTED]> wrote: > Can I get reference to module object of current module (from which the > code is currently executed)? I know __import__('filename') should > probably do that, but the call contains redundant information (filename, > which needs to be updated), a

Re: call 'the following function' using decorators

2008-02-17 Thread castironpi
On Feb 15, 7:54 pm, [EMAIL PROTECTED] wrote: > > > > > I assert it's easier to write: > > > > > > start_new_thread( this_func ) > > > > > def thrA(): > > > > >     normal_suite() > > > > > > than > > > > > > def thrA(): > > > > >     normal_suite() > > > > > start_new_thread( thrA ) > > > > > > If

Re: Linux/Python Issues

2008-02-17 Thread Paul Boddie
On 17 Feb, 20:38, [EMAIL PROTECTED] wrote: > I went to Python.org, DL'd Python 2.5 source code per the usual > inadequate instructions and ran the make files successfully (sort of). > Python 2.5 works fine. But "from Tkinter import *" gets a "What's > Tkinter?" message. IDLE's no where to be found.

Re: QOTW: Re: dream hardware

2008-02-17 Thread castironpi
On Feb 16, 2:59 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Carl Banks wrote: > > On Feb 16, 1:39 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > >> Aahz wrote: > >>> In article <[EMAIL PROTECTED]>, > >>> Jeff Schwab  <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Feb 14, 10:50

Re: Solve a Debate

2008-02-17 Thread castironpi
On Feb 17, 7:05 am, Wolfgang Draxinger <[EMAIL PROTECTED]> wrote: > nexes wrote: > > there is more data that needed to be assigned(i.e. a couple > > megs of data) it would be simpler (and more efficient) to > > do a compare rather then assigning all that data to an array, > > since you are only goi

Re: Tkinter = Rodney Dangerfield?

2008-02-17 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Tkinter gets no respect. But IDLE's a Tkinter-based app and every > example I've Googled up shows Tkinter as needing about half as much > code as wx to do the same job. I'm beginning to Tkinter up my language > application. Am I making a big mistake? I still use tkinter

Re: Python Memory Manager

2008-02-17 Thread Steve Holden
Paul Rubin wrote: > Pie Squared <[EMAIL PROTECTED]> writes: >> Also, if it does, how does it deal with memory segmentation? This >> question bothers me because I've been trying to implement a moving >> garbage collector, and am not sure how to deal with updating all >> program pointers to objects o

Re: Python Memory Manager

2008-02-17 Thread MartinRinehart
I researched this for some Java I wrote. Try to avoid shuffling physical memory - you'll write a lot less code and it will be faster, too. Use an "allocated" list and an "available" list. Keep them in address order. Inserting (moving list elements from insertion point to end) and deleting (vice-ve

Re: How about adding rational fraction to Python?

2008-02-17 Thread Steve Holden
Lie wrote: >> Consider what happens when you add two fractions: >> >> 1/2 + 1/5 >> >> To do that, you have to take the LCD of the denomintor, in this case >> 10, so you get >> >> 5/10 + 2/10 = 7/10 >> >> Now imagine that you're adding a lot of different numbers with a lot >> of different bases. Th

Re: Python Memory Manager

2008-02-17 Thread Pie Squared
On Feb 17, 1:57 pm, Paul Rubin wrote: > Pie Squared <[EMAIL PROTECTED]> writes: > > Also, if it does, how does it deal with memory segmentation? This > > question bothers me because I've been trying to implement a moving > > garbage collector, and am not sure how to deal

Re: pyinstall and matplotlib

2008-02-17 Thread Stef Mientki
hi John, John Henry wrote: > Anybody willing to help? > I struggled the past few days with the same problem, and with the help of Werner Bruhin (wxPython list) I found a solution. I had 2 problems: - not finding mpl datapath - matplotlib insisted on installing backends that were distorted o

Re: sockets -- basic udp client

2008-02-17 Thread Douglas Wells
In article <[EMAIL PROTECTED]>, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: I have had some difficulty following the assertions, corrections, and misquoting in this article thread, so apologies in advance if I have missed a correction or misunderstood an assertion. [ quoting partially corre

Linux/Python Issues

2008-02-17 Thread MartinRinehart
I went to Python.org, DL'd Python 2.5 source code per the usual inadequate instructions and ran the make files successfully (sort of). Python 2.5 works fine. But "from Tkinter import *" gets a "What's Tkinter?" message. IDLE's no where to be found. What's not in the instructions is what directory

Tkinter Confusion

2008-02-17 Thread MartinRinehart
Everything I've read about Tkinter says you create your window and then call its mainloop() method. But that's not really true. This is enough to launch a default window from the console: >>>from Tkinter import * >>>foo = Tk() Google's great, but it has no truth meter. Do I inherit from Frame? Or

Tkinter = Rodney Dangerfield?

2008-02-17 Thread MartinRinehart
Tkinter gets no respect. But IDLE's a Tkinter-based app and every example I've Googled up shows Tkinter as needing about half as much code as wx to do the same job. I'm beginning to Tkinter up my language application. Am I making a big mistake? -- http://mail.python.org/mailman/listinfo/python-lis

Re: Python Memory Manager

2008-02-17 Thread Paul Rubin
Pie Squared <[EMAIL PROTECTED]> writes: > Also, if it does, how does it deal with memory segmentation? This > question bothers me because I've been trying to implement a moving > garbage collector, and am not sure how to deal with updating all > program pointers to objects on the heap, and thought

Re: How about adding rational fraction to Python?

2008-02-17 Thread Lie
> Consider what happens when you add two fractions: > > 1/2 + 1/5 > > To do that, you have to take the LCD of the denomintor, in this case > 10, so you get > > 5/10 + 2/10 = 7/10 > > Now imagine that you're adding a lot of different numbers with a lot > of different bases. That LCD's going to be p

Python Memory Manager

2008-02-17 Thread Pie Squared
I've been looking at the Python source code recently, more specifically trying to figure out how it's garbage collector works. I've gathered that it uses refcounting as well as some cycle-detection algorithms, but I haven't been able to figure out some other things. Does Python actually have a si

How to get current module object

2008-02-17 Thread Alex
Can I get reference to module object of current module (from which the code is currently executed)? I know __import__('filename') should probably do that, but the call contains redundant information (filename, which needs to be updated), and it'll perform unnecessary search in loaded modules li

Re: pyinstall and matplotlib

2008-02-17 Thread John Henry
Anybody willing to help? On Feb 14, 11:17 am, John Henry <[EMAIL PROTECTED]> wrote: > Thank you for the response. I am having trouble using the script. I > am assuming the TUI is the application this script was developed for > and did my best to replace that with the name of my own. > > To make

Re: flattening a dict

2008-02-17 Thread Arnaud Delobelle
On Feb 17, 4:03 pm, Boris Borcic <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > On Feb 17, 7:51 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > > >> BTW, I keep using the idiom itertools.chain(*iterable).  I guess that > >> during function calls *iterable gets expanded to a tuple.  Wouldn'

Re: Sys.exit() does not fully exit

2008-02-17 Thread Christian Heimes
Gary Herron wrote: > That's a good answer. However, it you *do* want threads, and you don't > want the main thread to wait for the threads to quit, you can make the > threads "daemon threads". See setDaemon method on Thread objects in the > threading module. In general you are right. But I do

Python 2.5.1 - sqlite3.dll issue

2008-02-17 Thread Roman Dargacz
-- http://mail.python.org/mailman/listinfo/python-list

CFP: DTVCS 2008 - Design, Testing and Formal Verification Techniques for Integrated Circuits and Systems

2008-02-17 Thread ss DTVCS
Apologies for any multiple copies received. We would appreciate it if you could distribute the following call for papers to any relevant mailing lists you know of. CALL FOR PAPERS Special Sess

Re: flattening a dict

2008-02-17 Thread Terry Jones
> "Arnaud" == Arnaud Delobelle <[EMAIL PROTECTED]> writes: Arnaud> BTW, I keep using the idiom itertools.chain(*iterable). I guess Arnaud> that during function calls *iterable gets expanded to a tuple. Arnaud> Wouldn't it be nice to have an equivalent one-argument function Arnaud> that takes

Re: Critique of first python code

2008-02-17 Thread George Sakkis
On Feb 17, 10:17 am, Matthew Marshall <[EMAIL PROTECTED]> wrote: > Dan Bishop wrote: > > I will say, however, that hasattr(item, '__iter__') isn't a perfect > > way of checking whether an object is iterable: Objects that just > > define __getitem__ are iterable too (e.g., UserList). > > Speaking of

Animated GIF in Tkinter

2008-02-17 Thread Surya Prakash Garg
Hello, I have created a frame in which i want to display an animated progressbar in a canvas. I use PhotoImage function of PIL. But it doesn't display the animated gif code looks like this self.imgobj = PhotoImage(file=imgpath) self.c = Canvas(self.frame2, bg='white',width=64,height=310) self

Re: Sys.exit() does not fully exit

2008-02-17 Thread Gary Herron
Christian Heimes wrote: > Harlin Seritt wrote: > >> When x is typed, everything does shut down but the main script never >> fully ends. Is there any way to get it to quit? >> > > You don't need threads. Please use the subprocess module instead of > threads + os.system. > > Christian > Th

Re: flattening a dict

2008-02-17 Thread Boris Borcic
George Sakkis wrote: > On Feb 17, 7:51 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > >> BTW, I keep using the idiom itertools.chain(*iterable). I guess that >> during function calls *iterable gets expanded to a tuple. Wouldn't it >> be nice to have an equivalent one-argument function that ta

Re: flattening a dict

2008-02-17 Thread George Sakkis
On Feb 17, 7:51 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > BTW, I keep using the idiom itertools.chain(*iterable). I guess that > during function calls *iterable gets expanded to a tuple. Wouldn't it > be nice to have an equivalent one-argument function that takes an > iterable of iterabl

Re: basic wxpython help

2008-02-17 Thread Mike Driscoll
On Feb 16, 3:06 pm, Vamp4L <[EMAIL PROTECTED]> wrote: > Thanks Mike, > Simple enough! I was wandering about the close method too, I had to > hack that together from what I knew about python already. I'll be > sure to join that mailing list. If you get the chance, check out the "wxPython in Act

Memory Issue

2008-02-17 Thread Robert Rawlins - Think Blue
Afternoon Guys, I've got what I would consider to be a strange memory leak within an application I've been working on. When the application is running the consumed system memory creeps up slowly, getting higher and higher. However, when looking at 'top' to display the memory allocation for

Re: Critique of first python code

2008-02-17 Thread Matthew Marshall
Dan Bishop wrote: > I will say, however, that hasattr(item, '__iter__') isn't a perfect > way of checking whether an object is iterable: Objects that just > define __getitem__ are iterable too (e.g., UserList). Speaking of which, what *is* the best way to check if an object is iterable? I always

how to set image from double values of pixels

2008-02-17 Thread jimgardener
hi i am using PIL to get and set image data.Using image.getdata() i can get a tuple of ints for each pixel. also i can use im.putdata(data) to set pixels . suppose i am given a double value as a pixel value (say 7245654.32456 which i may get from some image processing calc..) and thus i have an

Re: sockets -- basic udp client

2008-02-17 Thread Roy Smith
In article "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > If you don't care about the address of the sender, e.g. you are not > going to send anything back, is there an advantage to using recv()? At the system call level, recv() is marginally faster since there's less data to pass back and fort

Re: Sys.exit() does not fully exit

2008-02-17 Thread Christian Heimes
Harlin Seritt wrote: > When x is typed, everything does shut down but the main script never > fully ends. Is there any way to get it to quit? You don't need threads. Please use the subprocess module instead of threads + os.system. Christian -- http://mail.python.org/mailman/listinfo/python-list

Sys.exit() does not fully exit

2008-02-17 Thread Harlin Seritt
I have this script: import os, thread, threading, time, sys class Script1(threading.Thread): def run(self): os.system('runScript1.py') class Script2(threading.Thread): def run(self): os.system('runScript2.py') if __name__ == '__main__': s = Script1() s.start()

Re: mapping problem

2008-02-17 Thread [EMAIL PROTECTED]
On 16 fév, 11:35, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: (snip) > If > you're not a native English speaker, please say so Actually, from looking at the OP's GoogleGroup profile, I think we can safely assert he's not a native English speaker. -- http://mail.python.org/mail

Re: Solve a Debate

2008-02-17 Thread Wolfgang Draxinger
nexes wrote: > there is more data that needed to be assigned(i.e. a couple > megs of data) it would be simpler (and more efficient) to > do a compare rather then assigning all that data to an array, > since you are only going to be using 1 value and the rest > of the data in the array is useless.

Re: flattening a dict

2008-02-17 Thread Arnaud Delobelle
On Feb 17, 12:18 pm, Terry Jones <[EMAIL PROTECTED]> wrote: > Hi Arnaud & Benjamin > > Here's a version that's a bit more general. It handles keys whose values > are empty dicts (assigning None to the value in the result), and also dict > keys that are not strings (see the test data below). It's al

Re: Tkinter. Why the Need for a Frame, or no Frame?

2008-02-17 Thread W. Watson
Thanks very much. I'm somewhat new to this, but I would think that Frame might carry some properties not available to the root. If so, then there might be some advantage to it. 7stud wrote: > On Feb 16, 8:40 pm, "W. Watson" <[EMAIL PROTECTED]> wrote: >> The following two examples are from Grayso

Re: Tkinter. Why the Need for a Frame, or no Frame?

2008-02-17 Thread W. Watson
I did run them both, but not simultaneously. They looked the same to me. I should have probably captured both. I'll check for a small one somewhere. Francesco Bochicchio wrote: > On Sat, 16 Feb 2008 19:40:51 -0800, W. Watson wrote: > >> from Tkinter import * >> >> class App: >> def __init__

Re: flattening a dict

2008-02-17 Thread Terry Jones
Hi Arnaud & Benjamin Here's a version that's a bit more general. It handles keys whose values are empty dicts (assigning None to the value in the result), and also dict keys that are not strings (see the test data below). It's also less recursive as it only calls itself on values that are dicts.

Is there a way to "link" a python program from several files?

2008-02-17 Thread Stephen Brown
Take a look at Fred Lundh's Squeeze programme. quote ... " If all you need is to wrap up a couple of Python scripts and modules into a single file, Squeeze might be what you need. The squeeze utility can be used to distribute a complete Python application as one or two files, and run it using

Re: Tkinter. Why the Need for a Frame, or no Frame?

2008-02-17 Thread [EMAIL PROTECTED]
On Feb 17, 9:29 am, Francesco Bochicchio <[EMAIL PROTECTED]> wrote: > > Anyway, Tk() already opens a frame, so in the first example the buttons > are created inside that frame, while in the second example two frames > are created: the one creaded by Tk() il left empty but you should see it > (mayb

Re: Tkinter. Why the Need for a Frame, or no Frame?

2008-02-17 Thread 7stud
On Feb 16, 8:40 pm, "W. Watson" <[EMAIL PROTECTED]> wrote: > The following two examples are from Grayson's book on Tkinter. He's making a > simple dialog with three buttons. In the first example, he does not use the > Frame class, but in the second he does. Doesn't the first example need a > contai

Re: problem with mod_python

2008-02-17 Thread Pradnyesh Sawant
On 02:07, 17Feb2008, Graham Dumpleton wrote: > On Feb 17, 3:29 pm, Pradnyesh Sawant wrote: > > Hello, > > Your mod_python isn't compiled against Python 2.5 but is using an > older version. You will need to rebuild mod_python to use Python 2.5 > instead. You cannot just point mod_python at the Pyt

Re: problem with mod_python

2008-02-17 Thread Graham Dumpleton
On Feb 17, 3:29 pm, Pradnyesh Sawant <[EMAIL PROTECTED]> wrote: > Hello, > I have a small program which does 'import hashlib'. This program runs fine > with python2.5. But when I try running the same program through mod_python, > I get the error: 'ImportError: No module named hashlib' in the apache

blog

2008-02-17 Thread yoga
I have new blog. please seemy blog and give me score for my blog. My blog is www.cahenom.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: xmltramp with python2.(4-5)

2008-02-17 Thread Pradnyesh Sawant
On 22:51, 16Feb2008, John Machin wrote: > On Feb 17, 5:40 pm, Pradnyesh Sawant wrote: > > fire up python2.4 interactive prompt > do this: > import sys; sys.path > import xmltramp; xmltramp.__file__ > > then fire up python2.5 interactive prompt > do this: > import sys; sys.path Hey, thanks a lot

Re: class static variables and __dict__

2008-02-17 Thread Arnaud Delobelle
On Feb 16, 11:59 pm, Zack <[EMAIL PROTECTED]> wrote: > Zack wrote: > > Diez B. Roggisch wrote: > >> Zack schrieb: > >>> If I have a class static variable it doesn't show up in the __dict__ > >>> of an instance of that class. > > >>> class C: > >>>    n = 4 > > >>> x = C() > >>> print C.__dict__ > >

Re: sockets -- basic udp client

2008-02-17 Thread Steve Holden
Paul Rubin wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: >> Historically, though, the ultimate authority on this kind of stuff is >> Richard Stevens and his Unix and TCP/IP books >> >> I recommend these books if you want to get into network programming. > > I keep wanting to get that bo

Re: flattening a dict

2008-02-17 Thread Boris Borcic
Arnaud Delobelle wrote: > > In Python you can do anything, even ...pass the Turing test with a one-liner. Back after 9/11, when US patriotism was the rage, Python knew how to answer correctly the query filter(lambda W : W not in 'ILLITERATE','BULLSHIT') And Python 3.0 slated for next August o

Re: Tkinter. Why the Need for a Frame, or no Frame?

2008-02-17 Thread Francesco Bochicchio
On Sat, 16 Feb 2008 19:40:51 -0800, W. Watson wrote: > from Tkinter import * > > class App: > def __init__(self, master): > fm = Frame(master) > Button(fm, text='Left').pack(side=LEFT) > Button(fm, text='This is the Center button').pack(side=LEFT) > Button

Re: flattening a dict

2008-02-17 Thread Arnaud Delobelle
On Feb 17, 3:56 am, Benjamin <[EMAIL PROTECTED]> wrote: > How would I go about "flattening" a dict with many nested dicts > within? The dicts might look like this: > {"mays" : {"eggs" : "spam"}, > "jam" : {"soda" : {"love" : "dump"}}, > "lamba" : 23} > > I'd like it to put "/" inbetween the dicts t