named pipe input

2005-09-01 Thread max(01)*
hi there. i have some problems understanding following behaviour. consider this: ... $ cat file_input_3.pl #!/usr/bin/perl open MIAPIPE, una_pipe; while ($riga = MIAPIPE) { print STDOUT ($riga); } $ cat file_input_3.py #!/usr/bin/python import sys MIAPIPE = open(una_pipe, r)

Re: named pipe input

2005-09-01 Thread max(01)*
Eric Nieuwland wrote: max(01)* wrote: $ cat file_input_3.py #!/usr/bin/python import sys MIAPIPE = open(una_pipe, r) for riga in MIAPIPE: print riga, ... [...] BUT if i try to do the same with the python code, something different happens: i have to type ALL the lines on console

Re: pipes like perl

2005-08-25 Thread max(01)*
many thanks to all the fellows who cared to answer! bye max -- http://mail.python.org/mailman/listinfo/python-list

pipes like perl

2005-08-23 Thread max(01)*
hi. in perl i can do this: ... if (open (MYPIPE, *some_system_command* |)) { ... *do_something* ... while ($answer = MYPIPE) { print $answer; } ... *do_something_more* ... } else { ... *do_something_else* ... }

Re: pipes like perl

2005-08-23 Thread max(01)*
bruno modulix wrote: max(01)* wrote: hi. (snip) it doesn't work, since *do_something* and *do_something_more* are always executed (it seems like MYPIPE = os.popen(*some_system_command*, r) does not raise any exception even if *some_system_command* does not exist/work... any help

Re: pipes like perl

2005-08-23 Thread max(01)*
infidel wrote: Here's one technique I use to run an external command in a particular module: stdin, stdout, stderr = os.popen3(cmd) stdin.close() results = stdout.readlines() stdout.close() errors = stderr.readlines() stderr.close()

Re: pipes like perl

2005-08-23 Thread max(01)*
max(01)* wrote: infidel wrote: Here's one technique I use to run an external command in a particular module: stdin, stdout, stderr = os.popen3(cmd) stdin.close() results = stdout.readlines() stdout.close() errors = stderr.readlines

regular expressions use

2005-08-22 Thread max(01)*
hi everyone. i would like to do some uri-decoding, which means to translate patterns like %2b/dhg-%3b %7E into +/dhg-; ~: in practice, if a sequence like %2b is found, it should be translated into one character whose hex ascii code is 2b. i did this: ... import re import sys modello =

stdin - stdout

2005-08-19 Thread max(01)*
hi. i was wondering, what's the simplest way to echo the standard input to the standard output, with no modification. i came up with: ... while True: try: raw_input() except EOFError: break ... but i guess there must be a simpler way. using bash i simply do 'cat', *sigh*!

Re: python and glut

2005-05-07 Thread max(01)*
Lonnie Princehouse wrote: DRI not working could also be a permissions issue; check to see if it works as root. that's it! :-) now, how can i make it work as joe user? bye max -- http://mail.python.org/mailman/listinfo/python-list

Re: python and glut

2005-05-07 Thread max(01)*
Lonnie Princehouse wrote: Welcome to the exciting world of trying to make graphics work on Linux =) DRI is direct rendering. [...] DRI not working could also be a permissions issue; check to see if it works as root. that's it! :-) now, how can i make it work as joe user? bye max --

Re: python and glut

2005-05-05 Thread max(01)*
Mike Meyer wrote: max(01)* [EMAIL PROTECTED] writes: $ python GLE.py freeglut (GLE.py): OpenGL GLX extension not supported by display ':0.0' what's up? what's missing? The GLX extension to your X server. i use a standard debian installation. I don't know which X debian uses

Re: python and glut

2005-05-05 Thread max(01)*
Lonnie Princehouse wrote: See if you can run `glxgears`, and read the output of `glxinfo`. $ glxgears Xlib: extension GLX missing on display :0.0. Error: couldn't get an RGB, Double-buffered visual $ glxinfo name of display: :0.0 Xlib: extension GLX missing on display :0.0. Xlib: extension

Re: python and glut

2005-05-05 Thread max(01)*
Lonnie Princehouse wrote: See if you can run `glxgears`, and read the output of `glxinfo`. If neither of those work, you will probably have better luck on a debian or XFree86/xorg forum than on c.l.py your hints were helpful anyway. thanks! ok, i uncommented the line: Load glx in

python and glut

2005-05-04 Thread max(01)*
hi there. i installed python2.3-opengl, then i tried one of those demos: #!/usr/bin/python2.3 # This is statement is required by the build system to query build info if __name__ == '__build__': raise Exception import sys from OpenGL.GL import * from OpenGL.GLE import * from

domain specific UI languages

2005-04-13 Thread max(01)*
hi. in a previous thread, mr lundh talks about the possibility to create domain specific UI languages using tkinter. can he (or anyone else who pleases) explain what they are? give some examples (simple is better)? bye macs -- http://mail.python.org/mailman/listinfo/python-list

Re: very simple tkinter demo program

2005-04-10 Thread max(01)*
Samantha wrote: I can not get it to run. S sorry about that. baybe it is a conflict between tabstop width in my editor and in my newsreader. i substituted tabs with spaces and i hope now you can run it. bye macs cuthere from Tkinter import * class MiaApp: def __init__(self, genitore):

visibility between modules

2005-04-09 Thread max(01)*
hi. if i have a single program file, different class instances can share information in (at least) two fashions: 1. using instance variables: class AClass: def __init__(self): self.att_1 = 42 self.att_2 = Hello! class AnotherClass: def __init__(self): self.att_1 =

serialize a tkinter thing

2005-04-09 Thread max(01)*
hi. i tried to serialize a list of StringVar's, but i got a pickle error. this got me to thinking that tkinter objects are not picklable (in general). would somebody confirm and/or give examples? thanks macs -- http://mail.python.org/mailman/listinfo/python-list

very simple tkinter demo program

2005-04-09 Thread max(01)*
hello. i wrote a very simple tkinter demo program that uses menus, buttons, labels, entries, frames and secondary toplevels. it is a python version of a java program made by a colleague. the user can create (Scrivi) a record with his second name, first name and date of birth, save (Salva) the

Re: redundant importr

2005-04-05 Thread max(01)*
Peter Hansen wrote: max(01)* wrote: Peter Hansen wrote: No it doesn't. I thought I was clear, but I can reword it for you: the files are compiled *in-memory* and the results are never written to disk. *if* they are compiled, where are they put, if the corresponding *.py files are on a non

Re: instance name

2005-04-05 Thread max(01)*
many many thanks to each and everyone who bothered to answer my op. best regards macs -- http://mail.python.org/mailman/listinfo/python-list

Re: redundant imports

2005-04-05 Thread max(01)*
Mike Meyer wrote: max(01)* [EMAIL PROTECTED] writes: Peter Hansen wrote: max(01)* wrote: hi everybody. suppose that code-1.py imports code-2.py and code-3.py (because it uses names from both), and that code-2.py imports code-3.py. if python were c, code-1.c should only *include* code-2.c

Re: redundant importr

2005-04-02 Thread max(01)*
Peter Hansen wrote: max(01)* wrote: Peter Hansen wrote: Not required except for performance reasons. If the .pyc files don't exist, the .py files are recompiled and the resulting bytecode is simply held in memory and not cached and the next startup will recompile all over again. but the other

instance name

2005-04-02 Thread max(01)*
hi. is there a way to define a class method which prints the instance name? e.g.: class class_1: ... def myName(self): ... what should i do here ... instance_1 = class_1() instance_1.myName() 'instance_1' bye macs -- http://mail.python.org/mailman/listinfo/python-list

Re: instance name

2005-04-02 Thread max(01)*
Andrew Koenig wrote: max(01)* [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] is there a way to define a class method which prints the instance name? The term the instance name is misleading, because it assumes, without saying so explicitly, that every instance has a unique name

Re: instance name

2005-04-02 Thread max(01)*
Irmen de Jong wrote: max(01)* wrote: hi. is there a way to define a class method which prints the instance name? e.g.: class class_1: ... def myName(self): ... what should i do here ... instance_1 = class_1() instance_1.myName() 'instance_1' bye macs What should the following do

Re: redundant imports

2005-04-01 Thread max(01)*
Peter Hansen wrote: max(01)* wrote: this leads me to another question. since *.pyc files are automatically created the first time an import statement in executed on a given module, i guess that if i ship a program with modules for use in a directory where the user has no write privileges then i

Re: tkinter destroy()

2005-04-01 Thread max(01)*
also the app seems to have too many variables and widgets defined as self objects. That isn't necessary unless they will be used outside the method they were created in (which labels and buttons usually aren't), so all you are doing is using up more memory than necessary. you are right, and at

Re: tkinter destroy()

2005-03-31 Thread max(01)*
[EMAIL PROTECTED] wrote: Your app seems to give the right state values only if you select 'Freni a posto'. But I see you recognize that with your 'FIXME' note. also the app seems to have too many variables and widgets defined as self objects. That isn't necessary unless they will be used

Re: problem with tkinter

2005-03-30 Thread max(01)*
Pierre Quentel wrote: Instead of indexing self.lab by strings, you can index them by the attributes themselves : self.lab[self.i], and change line 23 into for var in (self.s, self,i) For your example, I wouldn't have used the text option in the definition of the labels, then textvariable

Re: problem with tkinter

2005-03-30 Thread max(01)*
Eric Brunel wrote: On Tue, 29 Mar 2005 22:32:59 +0200, Pierre Quentel [EMAIL PROTECTED] wrote: [...] mr brunel, i thank you for prompt reply. i will take my time to read it carefully. meanwhile, i inform you and the ng that someone else gave me a quick and dirty answer to my problem, namely

redundant imports

2005-03-30 Thread max(01)*
hi everybody. suppose that code-1.py imports code-2.py and code-3.py (because it uses names from both), and that code-2.py imports code-3.py. if python were c, code-1.c should only *include* code-2.c, because the latter in turns includes code-3.c. inclusion of modules in c is a purely

Re: problem with tkinter

2005-03-30 Thread max(01)*
Eric Brunel wrote: On Tue, 29 Mar 2005 22:32:59 +0200, Pierre Quentel [EMAIL PROTECTED] wrote: Instead of indexing self.lab by strings, you can index them by the attributes themselves : self.lab[self.i], and change line 23 into for var in (self.s, self,i) I really think this is asking for

passing keyword args as a parameter

2005-03-29 Thread max(01)*
hi there! this post is somewhat a generalization of one previous question. i was wondering if it is possible to pass an argument list as a parameter to a function. example: def fun_con_pc(pc1 = Ciao!, pc2 = 42): print pc1 print pc2 fun_con_pc() fun_con_pc(pc1 = Addio...) fun_con_pc(pc2 = 666,

tkinter destroy()

2005-03-29 Thread max(01)*
hi people. when i create a widget, such as a toplevel window, and then i destroy it, how can i test that it has been destroyed? the problem is that even after it has been destroyed, the instance still exists and has a tkinter name, so testing for None is not feasible: import Tkinter fin =

Re: tkinter destroy()

2005-03-29 Thread max(01)*
Eric Brunel wrote: On Tue, 29 Mar 2005 10:37:10 GMT, max(01)* [EMAIL PROTECTED] wrote: hi people. when i create a widget, such as a toplevel window, and then i destroy it, how can i test that it has been destroyed? the problem is that even after it has been destroyed, the instance still exists

Re: passing keyword args as a parameter

2005-03-29 Thread max(01)*
Fredrik Lundh wrote: max(01)* [EMAIL PROTECTED] wrote: see what i mean? not really, but maybe arg = {pc2: 666, pc1: Addio...} fun_con_pc(**arg) is what you want? precisely! thanks a lot! macs -- http://mail.python.org/mailman/listinfo/python-list

problem with tkinter

2005-03-29 Thread max(01)*
hello. the following code: 1 from Tkinter import * 2 3 class MiaApp: 4 def __init__(self, genitore): 5 self.mioGenitore = genitore 6 self.i = IntVar() 7 self.i.set(42) 8 self.s = StringVar() 9 self.s.set(Baobab) 10

problem with tkinter

2005-03-29 Thread max(01)*
hello. the following code: 1 from Tkinter import * 2 3 class MiaApp: 4 def __init__(self, genitore): 5 self.mioGenitore = genitore 6 self.i = IntVar() 7 self.i.set(42) 8 self.s = StringVar() 9 self.s.set(Baobab) 10

tkinter and textvariable option

2005-03-28 Thread max(01)*
hello everybody. i am a a bit of a newbie in python/tkinter,and i am experimenting a bit with widgets like checkbuttons. in python, you can create a checkbutton instance like this: self.tergicristalli = IntVar() self.b1 = Checkbutton(self.pulsanti_spunta) self.b1.configure( text =