Tkinter deadlock on graceful exit

2012-05-27 Thread Matteo Landi
Hi list, recently I started to work on an application [1] which makes use of the Tkinter module to handle interaction with the user. Simply put, the app is a text widget displaying a file filtered by given criteria, with a handy feature that the window is raised each time a new line is added to th

Re: Tkinter deadlock on graceful exit

2012-05-30 Thread Matteo Landi
On May/28, Matteo Landi wrote: > Hi list, > recently I started to work on an application [1] which makes use of the > Tkinter > module to handle interaction with the user. Simply put, the app is a text > widget displaying a file filtered by given criteria, with a handy feature th

Re: Tkinter deadlock on graceful exit

2012-05-31 Thread Matteo Landi
On Thu, May 31, 2012 at 3:42 AM, Terry Reedy wrote: > On 5/30/2012 6:19 PM, Matteo Landi wrote: >> >> On May/28, Matteo Landi wrote: >>> >>> Hi list, >>> recently I started to work on an application [1] which makes use of the >>> Tkinter >>

Re: Tkinter deadlock on graceful exit

2012-06-01 Thread Matteo Landi
On Thu, May 31, 2012 at 3:02 PM, Matteo Landi wrote: > On Thu, May 31, 2012 at 3:42 AM, Terry Reedy wrote: >> On 5/30/2012 6:19 PM, Matteo Landi wrote: >>> >>> On May/28, Matteo Landi wrote: >>>> >>>> Hi list, >>>> recently

Re: Tkinter deadlock on graceful exit

2012-06-02 Thread Matteo Landi
On Jun/01, Matteo Landi wrote: > On Thu, May 31, 2012 at 3:02 PM, Matteo Landi wrote: > > On Thu, May 31, 2012 at 3:42 AM, Terry Reedy wrote: > >> On 5/30/2012 6:19 PM, Matteo Landi wrote: > >>> > >>> On May/28, Matteo Landi wrote: > >>>>

Re: Tkinter deadlock on graceful exit

2012-06-03 Thread Matteo Landi
On Jun/02, Dennis Lee Bieber wrote: > On Sat, 2 Jun 2012 14:57:17 +0200, Matteo Landi > declaimed the following in gmane.comp.python.general: > > > > Lesson learned: never invoke Tkinter functions / methods outside the > > mainloop > > thread.. NEVER! > &g

osaic - create photo mosaics w/ Python

2011-06-20 Thread Matteo Landi
Hi list, yesterday I released a new version of "osaic", a Python library which enables users to create photo mosaics in a very simple way. Once installed, a bare ``python -mosaic IMG1 IMG2 IMG3 ..`` is enough to create and show on screen a mosaic where IMG2, IMG3 and others are combined togeth

Re: Playing WAV file with Python

2011-03-03 Thread Matteo Landi
I imagine he is looking for a cross-platform solution: n this case, I guess the most suitable solution is pygame. Regards, Matteo -- http://mail.python.org/mailman/listinfo/python-list

Re: while True or while 1

2012-01-21 Thread Matteo Landi
Probably because of the fact it is possible to set True equal to False and consequently then invalidate loop logic as presented below: True = False while True: ... On the other hand `1' will always be evaluated as a constant. Don't know, just guessing. Matteo On Jan/21, Andrea

Re: plot debugging problem

2010-05-11 Thread Matteo Landi
> (or figures) to return to the shell. Subsequent plots will be drawn > automatically without issuing show(), and > you’ll be able to plot graphs interactively. > > Best Regards > Sandy > ____ > Hotmail: Free, trusted and rich email se

Re: plot debugging problem

2010-05-11 Thread Matteo Landi
o be embedded in a GUI as well. >> > In Windows, if you’re working from interactive Python, you need only >> > issue show() once; close the figures >> > (or figures) to return to the shell. Subsequent plots will be drawn >> > automatically without issuing show(), an

Re: plot debugging problem

2010-05-12 Thread Matteo Landi
interactively in Python, be sure >>> > to call the function show() after all >>> > graphs have been generated, as it enters a user interface main loop >>> > that will stop execution of the rest of >>> > your code. The reason behind this behavior is that matplotlib i

Re: stopping execution window on error - newbie

2010-05-13 Thread Matteo Landi
dow. > > when the code finishes, the window closes, i do a time.sleep(10) to > see what has happened. > > unfortunately when there is an error it just closes the window. > anyway of seeing the error messages? > > thanks > > a > -- > http://mail.python.org/ma

Re: MySQL, Python, NumPy and formatted read

2010-05-23 Thread Matteo Landi
a single > tuple.  What I'd like is to somehow put the tuple into a NumPy array > with each value as one element.  Then I can continue to do some > numerical processing. > > Any advice/help? > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: function that counts...

2010-05-24 Thread Matteo Landi
t; have property x"). > > If speed is important, the global lookups can be localized: > > def prttn(m, n, map=itertools.imap, int=int, str=str, range=range): >return sum(m == sum(map(int, str(x))) for x in range(n)) > > Raymond > > > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Syntax question

2010-06-02 Thread Matteo Landi
[1,2,3,4] >>>> b = a >>>> c = [:] >>>> b[0] = 5 >>>> b > [5,2,3,4] >>>> # here's the issue >>>> a > [5,2,3,4] >>>> # and the resolution >>>> c > [1,2,3,4] > > Hope this helps. > > Geremy Condra > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Syntax question

2010-06-02 Thread Matteo Landi
gt; >>> b >> [5,2,3,4] >> >>> # here's the issue >> >>> a >> [5,2,3,4] >> >>> # and the resolution >> >>> c >> >> [1,2,3,4] >> >> Hope this helps. >> >> Geremy Condra > > Thank you for such fast answer! I quite catch, but: > As I see, the d[:] is equal to sentence "get the d array from the > first to the last element"? :) > > P. > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: List of lists surprising behaviour

2010-06-17 Thread Matteo Landi
7445996L) >>>> > > > So what is the right way to initialize to 0 a 2D array ? Is that way correct >  : > > >>>> t=[[0 for _ in range(2)] for _ in range(3)] > > It seems there is no more trouble now : > >>>> t > [[0, 0], [0, 0]

Serializing functions

2010-06-17 Thread Matteo Landi
here, with nothing in my hands; how would you implement this? Thanks in advance. [1] http://www.picloud.com/ -- Matteo Landi http://www.matteolandi.net -- http://mail.python.org/mailman/listinfo/python-list

Re: Serializing functions

2010-06-17 Thread Matteo Landi
On Thu, 2010-06-17 at 07:37 -0700, Paul Rubin wrote: > Matteo Landi writes: > > If you try and pickle a function, it is not pickled as a whole, > > indeed, once you unpickle it, it will raise an exception telling you > > that the target function was not found in the current m

Re: Serializing functions

2010-06-17 Thread Matteo Landi
On Thu, 2010-06-17 at 07:37 -0700, Paul Rubin wrote: > Matteo Landi writes: > > If you try and pickle a function, it is not pickled as a whole, > > indeed, once you unpickle it, it will raise an exception telling you > > that the target function was not found in the current m

Re: Serializing functions

2010-06-17 Thread Matteo Landi
On Thu, 2010-06-17 at 08:31 -0700, Stephen Hansen wrote: > On 6/17/10 6:23 AM, Matteo Landi wrote: > > itself. If you try and pickle a function, it is not pickled as a whole, > > indeed, once you unpickle it, it will raise an exception telling you > > that the target function

Re: super() woes (n00b)

2010-06-17 Thread Matteo Landi
doing wrong? > > I tried this, too: > >>>> class C(P): >    def __init__(self): >        super(__class__).__init__(self) >        print("I am a member of class C") > > >>>> x=C() > Traceback (most recent call last): >  File "", line 1, in >    x=C() >  File "", line 3, in __init__ >    super(__class__).__init__(self) > TypeError: must be type, not C >>>> > > > > -- > The missionaries go forth to Christianize the savages - > as if the savages weren't dangerous enough already. > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: how to delete "\n"

2010-07-12 Thread Matteo Landi
found there is still "\n" . Could someone help me why it is not > correct? > > Thank you > > > -- > http://mail.python.org/mailman/listinfo/python-list > > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: measuring a function time

2010-07-29 Thread Matteo Landi
t to do this (pseudocode): > start_time = get_current_time; > function(); > end_time = get_current_time; > print (end_time - start_time) > > the output should be 7600 (s) for example. What is the best and easiest way > to do that? > > Thanks, > > // Naderan *Mahmood; >

Re: pylint scores

2010-07-31 Thread Matteo Landi
will need > to work on your code), but tabs allow everyone to see code indented the way > -they- want to see it, not just the way the original author wanted to see > it. > This script (./this-pylint) will also save output from the test in a text > file, for make (or other dependency handling program) to use to avoid > re-pylint'ing unmodified code.  It'll give an error typically, if pytlint > detects any errors other than FIXME's (excluding ones, as I mentioned > before, that have a comment disabling the warning, of course). > I'm more than a little sad that pylint doesn't seem to be moving to python 3 > in any big hurry. > > > -- > http://mail.python.org/mailman/listinfo/python-list > > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Normalizing A Vector

2010-08-01 Thread Matteo Landi
will normalize > in more than one place. In fact, you may well want a vlen function. > > def vlen(seq): return math.sqrt(sum(x*x for x in seq)) > > -- > Terry Jan Reedy > > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL

2010-08-03 Thread Matteo Landi
> Thank you in advance. > > Thanks. > Navid > > > -- > http://mail.python.org/mailman/listinfo/python-list > > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Get name of file from directory into variable

2010-08-03 Thread Matteo Landi
g/mailman/listinfo/python-list > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Get name of file from directory into variable

2010-08-03 Thread Matteo Landi
ally, so is definitely the way to go. > > http://docs.python.org/library/glob.html > > -- > Rory Campbell-Lange > r...@campbell-lange.net > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Global variables problem

2010-08-04 Thread Matteo Landi
;> >>> Any help would be awesome : ) >>> >>> Regards, >>> Nav >>> >>> -- >>> http://mail.python.org/mailman/listinfo/python-list >> >> >> This is a working code, streamlined, but it is where the problem is: &

Re: Python Script Cannot Write to Directory

2010-08-04 Thread Matteo Landi
CTORY/DSTNTN_FILE_NAME") > > WTF; modules aren't callable. Typo? I suppose he/she would have written: shutil.copyfile("YOUR_SOURCE_FILE_NAME","DESTINATION_DIRECTORY/DSTNTN_FILE_NAME") Cheers. > > Cheers, > Chris > -- > http://blog.rebertia.com

Re: pylint scores

2010-08-06 Thread Matteo Landi
On Sun, Aug 1, 2010 at 12:27 PM, News123 wrote: > Hi, > > > On 07/31/2010 11:04 AM, Matteo Landi wrote: >> What are the messages one should really care about while evaluating >> its code using pylint? It's easy to get 5 scored with a "lot of public >> me

Re: Python Developer - HFT Trading firm - Chicago, IL

2010-08-18 Thread Matteo Landi
try), fantastic benefits and very generous relocation packages. > Please contact me immediately with a resume! > > Send resumes to: > > Rich Moss > r...@mossltd.com > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: palindrome iteration

2010-08-27 Thread Matteo Landi
> an integer of a negated expression. Given that Baba notes that this is > a beginners level query, it wouldn't have hurt to be a little bit more > verbose there. > > Richard > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Fibonacci: How to think recursively

2010-08-28 Thread Matteo Landi
ry writing that > case first, and then write the rest of it on that basis. > > -- >  \         “Science is a way of trying not to fool yourself. The first | >  `\     principle is that you must not fool yourself, and you are the | > _o__)               easiest person to fool.” —Rich

Re: palindrome iteration

2010-08-29 Thread Matteo Landi
", min(t.repeat()) > > t = Timer("is_palindrome_reversed('madamimadam')", "from __main__ > import is_palindrome_reversed") > print "is_palindrome_reversed", min(t.repeat()) > > The results: > is_palindrome_recursive 6.32680866827 > is_pali

Re: palindrome iteration

2010-08-29 Thread Matteo Landi
: while True: if str[i] != str[j]: return False i, j = i + 1, j - 1 return True except IndexError: return True On Sun, Aug 29, 2010 at 12:36 PM, Arnaud Delobelle wrote: > Matteo Landi writes: > >> W

Re: That interesting notation used to describe how long a loop will take.

2010-10-04 Thread Matteo Landi
pedia article about this > subject?  I imagine that it has a concise name. > > Thanks, > > Tobiah > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert a string into a list

2010-10-05 Thread Matteo Landi
;1', '2']" >> >>>>> [int(n) for n in re.findall(r'-?\d+', s)] >> >> [1, 2] >> >> >> >> An alternative is: >> >> >> >>>>> s = "['1', '2']" >> >>&g

Re: Control webbrowser from Python script

2010-10-09 Thread Matteo Landi
t possible to control any webbrowser from Python ? For example to > issue http POST and GET  command > Thanks > Johny > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Does everyone keep getting recruiting emails from google?

2010-10-14 Thread Matteo Landi
gt; Grant Edwards               grant.b.edwards        Yow! Oh my GOD -- the >                                  at               SUN just fell into YANKEE >                              gmail.com            STADIUM!! > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matte

Re: How to implement retrying a lock tidily in Python?

2010-10-17 Thread Matteo Landi
the number > of tries in the for loop.  I need a way to handle the case where we > run out of tries (and *haven't* done what we needed to do) separately > from the case where it worked OK. > > I can see all sorts of messy ways to handle this with a flag of some > sort but is

Re: pylint -- should I just ignore it sometimes?

2010-10-20 Thread Matteo Landi
irst example puts the emphasis on the *technique*, not the > variables. The second obscures it behind needlessly longer but still > generic names. > > You are absolutely right to insist on meaningful variable names. Where > you go wrong is to assume that single letter names can't be meaningful. > > > > -- > Steven > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary of lists strange behaviour

2010-11-09 Thread Matteo Landi
x27;: []} > In [216]: rg['a'].append('x') > In [217]: rg > Out[217]: {'a': ['x'], 'b': ['x']} > > What I meant was appending 'x' to the list pointed by the key 'a' in the > dictionary 'rg'. Why rg['b'] is written too? > > Thanks. > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: An easier way to do this? (spoiler if you're using pyschools for fun)

2010-11-10 Thread Matteo Landi
git([1, 23, 456]) ) > # 9 9 10 > > # Use generator expression with built-in sum function > > def getSumOfLastDigit(numList): >    return sum(int(str(i)[-1:]) for i in numList) > > print(getSumOfLastDigit([12, 23, 34]), >      getSumOfLastDigit([2, 3, 4]), >      getSumOfLastDigit([1, 23, 456]) ) > # 9 9 10 > > -- > Terry Jan Reedy > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list