Tix Tree open/close issue

2006-07-13 Thread Sorin Schwimmer
Hi, I tried for the first time a Tix Tree, so, if my question is naive, I apologize upfront. The following code: from Tix import * r=Tk() tr=Tree(r) tr.subwidget('hlist').add('br1',text='branch 1') tr.subwidget('hlist').add('br1.b1',text='branch 1-1') tr.subwidget('hlist').add('br1.b1.b1',text

Tix Tree open/close issue

2006-07-14 Thread Sorin Schwimmer
It works. Thanks Rob. Sorin __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list

Tkinter's createfilehandler - attempt to run parallel threads

2006-07-27 Thread Sorin Schwimmer
Hi,The project that I'm working for runs a PostgreSQL database on a remote machine and several Python clients all over the place. The objects usualy have in their constructor a query to the database. As the query is executed on the remote machine, I'm trying to be fancy and execute it while buildin

Tkinter question

2006-10-23 Thread Sorin Schwimmer
Hi All,Is it possible to have a widget id while it is created?Something like this:Button(root, text='...', command= lambda v=: fn(v)).grid()and then the function:def fn(v):  v['bg']='BLUE' # or maybe nametowidget(v)['bg']='BLUE'Thanks,Sorin-- http://mail.python.org/mailman/listinfo/python-list

Tkinter question

2006-10-24 Thread Sorin Schwimmer
Thanks for everybody's advice, on both forums (tkinter-discuss & python-list).I end up using Fredrik's Lundh solution, since, in my project, multiple buttons are using the same callback, and their creation is controlled by the interaction with the user.Thanks again,Sorin-- http://mail.python.org/m

But it was yesterday here!

2006-11-07 Thread Sorin Schwimmer
(the quote is from 'Le gendarme et les extra-terrestres', a must-see Frech comedy)Hi All,I'm trying to use the smtplib - I did it so many times already. The import statement fails, as theSMTP name cannot be imported. Digging more, I found that SMTP fails becauseemail.base64MIME cannot be imported (

But it was yesterday here!

2006-11-07 Thread Sorin Schwimmer
> I bet you have an email.py somewhere in your sources... You won the bet. I owe you one :-)Thanks,Sorin-- http://mail.python.org/mailman/listinfo/python-list

Tkinter, grid, in_: widget definition order significant ?!

2006-07-04 Thread Sorin Schwimmer
while l2 (defined after f) is OK.That's the way it is intended to be? How would I grid stuff in dynamically created windows?Thanks for your advice,Sorin Schwimmer How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call rates.-- http://mail.python.org/mailman/listinfo/python-list

signal - no update 'til I move the mouse

2006-08-24 Thread Sorin Schwimmer
Hi, My project needs to allow some inter-process communication. That one is solved, and when an answer is sent, it goes to its destination via a signal. Then, the Tkinter screen needs to be updated, so the user can take the next action. On my laptop it works instantly, on my desktop, only after I

rollover effect

2006-08-28 Thread Sorin Schwimmer
Hi, For the right-click event, you should use a bind to . If you have a new version of Python, chances are that you already have Tix installed. Tix, like Pmw, is an extension package for Tkinter, and it also offers a Balloon widget. See the following example: from Tix import * r=Tk() l=Label(r

How to let a loop run for a while before checking for break condition?

2006-08-28 Thread Sorin Schwimmer
to Fredrik Lundh I'm afraid Claudio Grondi can't use your solution, as he needs it hosted on Windows, which lacks signal.alarm. to Claudio Grondi How about splitting your loop in two? The first loop would check for your boolean, which is changed by your timer, the second loop will check for your "

How to let a loop run for a while before checking for break condition?

2006-08-28 Thread Sorin Schwimmer
I am thinking on something in the following form: import time import thread delay=True def fn() global delay time.sleep() delay=False thread.start_new_thread(fn,()) while delay: ... while : ... Or, if you need to use "break", the second loop may be something like: while T

Tkinter listbox:get

2006-09-10 Thread Sorin Schwimmer
lb.curselection() won't return an integer, but a tuple of strings. Also, a StringVar receives a new value with the set() method. So, you'll have to write something like:idx=lb.curselection()StringValue.set(lb.get(int(idx[0])))This will grab the first value from the tuple, convert it in integer, and

overrideredirect and Text widget

2006-09-21 Thread Sorin Schwimmer
Hi,I'm trying to place in an undecorated window a Text widget, and a button to close the window/save widget's content. My test code is the following:from Tkinter import *root=Tk()root['bg']='' # transparent backgroundroot.overrideredirect(1) # get rid of borderroot.geometry("+80+120") # place on sc

overrideredirect and Text widget

2006-09-22 Thread Sorin Schwimmer
Hi again,Last afternoon I posted a question regarding the loss of keyboard in an undecorated window. Last night I tried again, at home, and the same code worked fine. The difference: it failed under (Gentoo) Linux, it succeeded under Win 2000, both running Python 2.4.x.So, I guess, my question now

I need some help with a regexp please

2006-09-22 Thread Sorin Schwimmer
Hi,My $0.02:re.compile('^\w+([\.-]?\w+)[EMAIL PROTECTED]([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|intl|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$')I picked it up from the Net, and while it may be not perfect (you've got lots of reply's telling you why),it's good enough for me.Good luck,Sorin--

Python 2.5 install on Gentoo Linux: failed dmb and _tkinter

2007-01-10 Thread Sorin Schwimmer
Hi All, After a disaster in which I lost my whole harddrive, I decided to install the newest everything that I use. I put the latest Gentoo Linux, with gcc 4.1.1, installed tcl/tk 8.4.14 and tried Python 2.5. I tried with and without the suggested -fwrapv compiler option, and make gave me the same

Re: Python 2.5 install on Gentoo Linux: failed dmb and _tkinter

2007-01-11 Thread Sorin Schwimmer
> Did you add /usr/local/lib to /etc/ld.so.conf? It's there Sorin Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.yahoo.com -- http://mail.python.org/mailman/listinfo/py

Re: Python 2.5 install on Gentoo Linux: failed dmb and _tkinter

2007-01-14 Thread Sorin Schwimmer
# ldconfig -p | grep "/usr/local/lib" libtk8.4.so (libc6) => /usr/local/lib/libtk8.4.so libtcl8.4.so (libc6) => /usr/local/lib/libtcl8.4.so Sorin Now that's room service! Choose from over 150,

Enter Enter... troubles

2007-02-14 Thread Sorin Schwimmer
Hi All, In my application I have a class like this: from Tkinter import * class MyClass: def __init__(self, root): self.property=value self.aButton=Button(root, text='Press me!') self.aButton.bind('', self.handler) self.aButton.bind('',self.handler)

Re: Enter Enter... troubles

2007-02-17 Thread Sorin Schwimmer
It works, thanks. Sorin Need Mail bonding? Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users. http://answers.yahoo.com/dir/?link=list&sid=396546091 -- http://mail.python.org/mailman/listinfo

Function stopping a function

2007-11-22 Thread Sorin Schwimmer
Hi All, We all know that a function can launch the execution of another function. How can a function stop the execution of another function? For instance, lenghty_function() executes, when an external event triggers cancel(), which is supposed to abruptly stop lengthy_function(), reset some varia

Re: Function stopping a function

2007-11-23 Thread Sorin Schwimmer
In my situation, there is a device with keyboard that allows some user input. In the same time, the device is connected to a standard PC, and there may be some communication there. The lengthy_function() resides and executes in the device, and so is cancel(). Lengthy_function() is pretty linear:

Some test fail on my new Python 2.6

2009-04-06 Thread Sorin Schwimmer
Hi All, I just downloaded and compiled Python 2.6 on a Gentoo Linux, IBM NetVista. After going through the usual steps (./configure, make), I ran a test (make test), and got some unexpected issues, which are detailed here: # ./python Lib/test/test_tcl.py Traceback (most recent call last): Fi

Re: Some test fail on my new Python 2.6

2009-04-07 Thread Sorin Schwimmer
> Run 'make test' instead of running them one by one. I did it *before* going one by one. I then tried individual tests in hope of getting hints of what to look for. Actualy, for the first three tests, the "make test" script commented that it is unusual for them to fail on my platform (linux2)

Re: Some test fail on my new Python 2.6

2009-04-07 Thread Sorin Schwimmer
I wanted to replace my old Python 2.4 and tcl/tk 8.4 with tcl/tk 8.5.6 and Python 2.6, mainly so that I can enjoy ttk. tcl/tk was installed from sources without any problem, I started a wish and worked. Now, for the Python, here are all the issues signaled by make test: running build running b

Re: Some test fail on my new Python 2.6

2009-04-08 Thread Sorin Schwimmer
Thanks for the pointers. Here are some answers: > Ok, so DBM wasn't built because it couldn't find the external symbol > 'dbm_firstkey'. I have no idea off the top of my head why that would > happen, but I don't think you really care at the moment since you are > trying to get tkinter working.

Re: Some test fail on my new Python 2.6

2009-04-08 Thread Sorin Schwimmer
Hello again, /usr/local/lib is in /etc/ld.so.conf. The files are real. However, creating symlinks in /usr/lib targeting the libraries in /usr/local/lib, then recompiling, solved the tkinter problem. So, the conclusion is that only /usr/lib is consulted for the tcl/tk libraries. multiprocessing -

Autocompletion

2009-04-09 Thread Sorin Schwimmer
Hi All, Does anybody knows about a module to assist with text autocompletion for a given dictionary? Thanks, SxN __ Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know

Re: Autocompletion

2009-04-09 Thread Sorin Schwimmer
Sorry for being careless in my choice of words: when I wrote "dictionary", I meant a collection of words in any given human language, not a Python dictionary. Perhaps I should try to explain a bit more what I try to accomplish: in a notebook the user will write text, and certain words (collect

String multi-replace

2010-11-17 Thread Sorin Schwimmer
Hi All, I have to eliminate diacritics in a fairly large file. Inspired by http://code.activestate.com/recipes/81330/, I came up with the following code: #! /usr/bin/env python import re nodia={chr(196)+chr(130):'A', # mamaliga chr(195)+chr(130):'A', # A^ chr(195)+chr(142):'I',

Re: String multi-replace

2010-11-17 Thread Sorin Schwimmer
Thanks for your answers. Benjamin Kaplan: of course dict is a type... silly me! I'll blame it on the time (it's midnight here). Chris Rebert: I'll have a look. Thank you both, SxN -- http://mail.python.org/mailman/listinfo/python-list

Re: String multi-replace

2010-11-17 Thread Sorin Schwimmer
Steven D'Aprano: the original file is 139MB (that's the typical size for it). Eliminating diacritics is just a little toping on the cake; the processing is something else. Thanks anyway for your suggestion, SxN PS Perhaps I should have mention that I'm on Python 2.7 -- http://mail.python.org