Jeff Cagle | 1 Oct 05:15 2008
Picon

validation woes

I want an Entry widget to accept a single digit only.  Here's the attempt:

---
import Tkinter as Tk

class MyEntry(Tk.Entry):

    def __init__(self, parent, **kwargs):
        kwargs['validate']='key'     # could also be 'all' -- has the 
same result
        kwargs['vcmd']=self.validate
        Tk.Entry.__init__(self, parent, **kwargs)

    def validate(self):
        print self.get()  # diagnostic only
        if self.get() in [''] + list("123456789"):
            return True
        else:
            self.bell()
            return False

if __name__=="__main__":
    main = Tk.Tk()
    main.e = MyEntry(main)
    main.e.grid()
    main.mainloop()

---

I'd like to think this is straightforward, but No.
(Continue reading)

Picon

Fwd: Python + Tk/Tcl building

Hello!

I want to build python with Tk/Tcl by mysel. When writing coomand
¨import Tkinter¨ tehere is an error

>>> import Tkinter
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/usr/local/Py/lib/python2.5/lib-tk/Tkinter.py", line 38, in <module>
   import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
>>>

I don understand, how should I bild python for it work correctly. Is
there some options in ./configure command for this?

--

-- 
Best regards, Makarov Alexey
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Tim Jones | 1 Oct 17:53 2008

Re: Fwd: Python + Tk/Tcl building

On Oct 1, 2008, at 8:22 AM, Алексей Макаров wrote:

> Hello!
>
> I want to build python with Tk/Tcl by mysel. When writing coomand  
> ¨import Tkinter¨ tehere is an error
>
>>
> import Tkinter
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/local/Py/lib/python2.5/lib-tk/Tkinter.py", line 38, in  
> <module>
>   import _tkinter # If this fails your Python may not be configured  
> for Tk
> ImportError: No module named _tkinter
>>
>
>
> I don understand, how should I bild python for it work correctly. Is  
> there some options in ./configure command for this?

Hello Alexey,

In the case of TKinter, you need to make sure that the TCL/TK  
developer sources are built and installed properly as the first step.   
Once they are installed, you will need to edit your Python Modules/ 
Setup file and remove the comment symbols in front of the TKInter  
entries that apply to what you are building.  You can find this by  
searching for _tkinter once you've opened the Setup file in your editor.
(Continue reading)

Picon

Python + Tk/Tcl building

Hello!

I want to build python with Tk/Tcl by mysel. When writing coomand
¨import Tkinter¨ tehere is an error

>>> import Tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Py/lib/python2.5/lib-tk/Tkinter.py", line 38, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
>>>

I don understand, how should i buld python for it work correctly. Is
there some options in ./configure command for this?
--

-- 
Best regards, Makarov Alexey
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Guilherme Polo | 6 Oct 22:22 2008
Picon

Re: validation woes

On Wed, Oct 1, 2008 at 12:15 AM, Jeff Cagle <jrcagle <at> juno.com> wrote:
> I want an Entry widget to accept a single digit only.  Here's the attempt:
>
> ---
> import Tkinter as Tk
>
> class MyEntry(Tk.Entry):
>
>   def __init__(self, parent, **kwargs):
>       kwargs['validate']='key'     # could also be 'all' -- has the same
> result
>       kwargs['vcmd']=self.validate
>       Tk.Entry.__init__(self, parent, **kwargs)
>
>   def validate(self):
>       print self.get()  # diagnostic only
>       if self.get() in [''] + list("123456789"):
>           return True
>       else:
>           self.bell()
>           return False
>
> if __name__=="__main__":
>   main = Tk.Tk()
>   main.e = MyEntry(main)
>   main.e.grid()
>   main.mainloop()
>
> ---
>
(Continue reading)

Fred Mailhot | 9 Oct 22:16 2008
Picon

Re: Unicode on Mac (yet again)

*bump*

2008/8/18 Dave Opstad <dave.opstad <at> monotypeimaging.com>:
>
> The first thing that strikes me is an endian issue. You're asking for
> Unicode 026E, but Unicode 6E02 might be what you're getting (and it's in the
> CJK ideograph range). Is there an endian compiler flag you need to set when
> you recompile your python for linking to Tcl/Tk 8.5?

Did some tests, it's not and endian thing.

Has *anybody* gotten Unicode working on Macs with Tkinter Label or Text widgets?

Any help is *much* appreciated...

F.
Allen Taylor | 23 Oct 22:16 2008

Proposal for thread-safe Tkinter

I was given the task of upgrading a Python/Tkinter GUI application to the latest versions of Python and Tk. After a while, I realized that the application had not been written in a thread-safe manner. Multiple threads would simply use the Tk object directly. The application apparently ran fine (i.e., didn't crash!) using older versions of Python (2.2) and Tk (8.3), but it started to have serious problems (i.e., crashing) after using the latest versions.
 
The problem is that there isn't enough budget to fix the whole application. So, I invested a bit of time to develop mtTkinter, a thread-safe version of Tkinter. Importing mtTkinter actually modifies the original Tkinter in such a way to make it thread-safe, recognizing and diverting out-of-thread calls to the Tk object creation thread via a queue and an 'after' event. I think it works quite well, requiring basically no changes to the application other than to import mtTkinter instead of (or in addition to) Tkinter. Even packages that use Tkinter (e.g., Pmw) benefit.
 
I would like to contribute this module (single file, about 160 lines) to the Python community, but I don't know how. I'm new to Python and am not initiated in the deep Pythonic developer world. Can someone give me some pointers? Many thanks.
 
Allen B. Taylor
MDA
9445 Airport Road
Brampton, ON  L6S 4J3
905-790-2800 ext. 4350
allen.taylor <at> mdacorporation.com
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Ron Longo | 24 Oct 03:31 2008
Picon
Picon

Re: Proposal for thread-safe Tkinter

Allen,
 
Sounds like you have a great module there which many people could benefit from.  I would recommend you post your module to the tkinter wiki (http://tkinter.unpythonic.net/wiki/).  You may also consider packaging it up and posting it to the python package index.
 
Thanks,
Ron
 
 
----- Original Message -----
Sent: Thursday, October 23, 2008 4:16 PM
Subject: [Tkinter-discuss] Proposal for thread-safe Tkinter

I was given the task of upgrading a Python/Tkinter GUI application to the latest versions of Python and Tk. After a while, I realized that the application had not been written in a thread-safe manner. Multiple threads would simply use the Tk object directly. The application apparently ran fine (i.e., didn't crash!) using older versions of Python (2.2) and Tk (8.3), but it started to have serious problems (i.e., crashing) after using the latest versions.
 
The problem is that there isn't enough budget to fix the whole application. So, I invested a bit of time to develop mtTkinter, a thread-safe version of Tkinter. Importing mtTkinter actually modifies the original Tkinter in such a way to make it thread-safe, recognizing and diverting out-of-thread calls to the Tk object creation thread via a queue and an 'after' event. I think it works quite well, requiring basically no changes to the application other than to import mtTkinter instead of (or in addition to) Tkinter. Even packages that use Tkinter (e.g., Pmw) benefit.
 
I would like to contribute this module (single file, about 160 lines) to the Python community, but I don't know how. I'm new to Python and am not initiated in the deep Pythonic developer world. Can someone give me some pointers? Many thanks.
 
Allen B. Taylor
MDA
9445 Airport Road
Brampton, ON  L6S 4J3
905-790-2800 ext. 4350
allen.taylor <at> mdacorporation.com

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
C. Allen | 24 Oct 04:05 2008

Re: Proposal for thread-safe Tkinter

cool work, that would be a great thing to have.

On Thu, 2008-10-23 at 16:16 -0400, Allen Taylor wrote:
I was given the task of upgrading a Python/Tkinter GUI application to the latest versions of Python and Tk. After a while, I realized that the application had not been written in a thread-safe manner. Multiple threads would simply use the Tk object directly. The application apparently ran fine (i.e., didn't crash!) using older versions of Python (2.2) and Tk (8.3), but it started to have serious problems (i.e., crashing) after using the latest versions.
 
The problem is that there isn't enough budget to fix the whole application. So, I invested a bit of time to develop mtTkinter, a thread-safe version of Tkinter. Importing mtTkinter actually modifies the original Tkinter in such a way to make it thread-safe, recognizing and diverting out-of-thread calls to the Tk object creation thread via a queue and an 'after' event. I think it works quite well, requiring basically no changes to the application other than to import mtTkinter instead of (or in addition to) Tkinter. Even packages that use Tkinter (e.g., Pmw) benefit.
 
I would like to contribute this module (single file, about 160 lines) to the Python community, but I don't know how. I'm new to Python and am not initiated in the deep Pythonic developer world. Can someone give me some pointers? Many thanks.
 
Allen B. Taylor
MDA
9445 Airport Road
Brampton, ON  L6S 4J3
905-790-2800 ext. 4350
allen.taylor <at> mdacorporation.com _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss <at> python.org http://mail.python.org/mailman/listinfo/tkinter-discuss
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Allen Taylor | 24 Oct 19:56 2008

Re: Proposal for thread-safe Tkinter

All,
Please find mtTkinter, a thread-safe version of Tkinter, at http://tkinter.unpythonic.net/wiki/mtTkinter. If you find it useful, or if you find bugs, please let me know.
Enjoy!
Allen

>>> "Ron Longo" <ron.longo <at> cox.net> 2008-10-23 21:31 >>>
Allen,
 
Sounds like you have a great module there which many people could benefit from.  I would recommend you post your module to the tkinter wiki (http://tkinter.unpythonic.net/wiki/).  You may also consider packaging it up and posting it to the python package index.
 
Thanks,
Ron
 
----- Original Message -----
Sent: Thursday, October 23, 2008 4:16 PM
Subject: [Tkinter-discuss] Proposal for thread-safe Tkinter

I was given the task of upgrading a Python/Tkinter GUI application to the latest versions of Python and Tk. After a while, I realized that the application had not been written in a thread-safe manner. Multiple threads would simply use the Tk object directly. The application apparently ran fine (i.e., didn't crash!) using older versions of Python (2.2) and Tk (8.3), but it started to have serious problems (i.e., crashing) after using the latest versions.
 
The problem is that there isn't enough budget to fix the whole application. So, I invested a bit of time to develop mtTkinter, a thread-safe version of Tkinter. Importing mtTkinter actually modifies the original Tkinter in such a way to make it thread-safe, recognizing and diverting out-of-thread calls to the Tk object creation thread via a queue and an 'after' event. I think it works quite well, requiring basically no changes to the application other than to import mtTkinter instead of (or in addition to) Tkinter. Even packages that use Tkinter (e.g., Pmw) benefit.
 
I would like to contribute this module (single file, about 160 lines) to the Python community, but I don't know how. I'm new to Python and am not initiated in the deep Pythonic developer world. Can someone give me some pointers? Many thanks.
 
Allen B. Taylor
MDA
9445 Airport Road
Brampton, ON  L6S 4J3
905-790-2800 ext. 4350
allen.taylor <at> mdacorporation.com

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Gmane