From: Martin P. Hellwig on
On 06/08/10 22:14, Ethan Furman wrote:
> Grant Edwards wrote:
>> On 2010-06-08, Martin v. Loewis <martin(a)v.loewis.de> wrote:
>>>> TkInter -> Tcl -> Tk -> Xlib
>>>>
>>>> Is the Tcl intepreter really need to use this GUI? Why not:
>>>>
>>>> (Pyton ->) Tkinter-API -> Xlib ?
>>> Even if this was possible (which it is not)
>>
>> Why is it not possible? It seems to have been done for other
>> languages.
>>
<cut>
Yes indeed, however gp forgot another step:
tkinter > tcl > tk > xlib/xcb > x server
There are already some more or less usable (though they look abandoned)
experiments that do this:
https://launchpad.net/twisted-x11
http://python-xlib.sourceforge.net/

However I don't think that x11 represents that majority (just a gut
feeling I have no data to back this claim up) of gui users, so an equal
solution should be found for windows and macs.

I do think it is technically possible to have your own window manager in
python on x11 but I have no idea if you have equal possibilities on mac
and windows (for example to define your own window decoration).
Though considering tk does just that I would guess this to be the case.

--
mph
From: geremy condra on
On Tue, Jun 8, 2010 at 3:09 PM, Lie Ryan <lie.1296(a)gmail.com> wrote:
> On 06/09/10 01:17, bart.c wrote:
>>
>> "Grant Edwards" <invalid(a)invalid.invalid> wrote in message
>> news:hullf3$hl4$1(a)reader1.panix.com...
>>> On 2010-06-08, Kevin Walzer <kw(a)codebykevin.com> wrote:
>>>
>>>> Since Tk already provides a basic GUI toolset, and Python can interface
>>>> with it more directly than it can with other toolkits
>>>> (PyGui -> PyGtk -> Gtk -> Xlib),
>>>
>>> Compare that to this:
>>>
>>> TkInter -> Tcl -> Tk -> Xlib
>>
>> Is the Tcl intepreter really need to use this GUI? Why not:
>>
>> (Pyton ->) Tkinter-API -> Xlib ?
>>
>> Most of the work of designing a GUI is, well, designing it. That's
>> already been done for Tkinter so why not just implement the same spec in
>> Python (with whatever lower-level code is needed). Then extending it
>> should be simpler.
>>
>>>> it's not clear to me what is gained by starting from scratch here.
>>>> (Is it the presence of the Tcl interpreter? I know Tcl is not to
>>>> everyone's taste, but it is an amazing language...)
>>
>> Some people aren't interested in the amazing language. Only the graphics
>> API that goes with it.
>
> How about shifting the viewpoint a little bit. Tcl is like regular
> expression engine and the Tk is like the re API.
>
> Much like regex a DSL for matching text, Tcl/Tk is pretty much a DSL for
> creating GUI (anyone knows any real program fully written in
> non-embedded Tcl?).
>
> Nobody complains that python included a regular expression engine in its
> standard distribution; so why complain that python included a Tcl
> expression engine in its standard distribution.

This is a silly argument.

REs are not full programming languages, even from a theoretical point
of view, aMSN is written in Tcl, as wikipedia would have told you, and
having to depend on the tools of another language to get commonly
desired functionality is not a good thing for a programming language.

Geremy Condra
From: Martin v. Loewis on
Am 08.06.2010 20:15, schrieb Grant Edwards:
> On 2010-06-08, Martin v. Loewis<martin(a)v.loewis.de> wrote:
>>> TkInter -> Tcl -> Tk -> Xlib
>>>
>>> Is the Tcl intepreter really need to use this GUI? Why not:
>>>
>>> (Pyton ->) Tkinter-API -> Xlib ?
>>
>> Even if this was possible (which it is not)
>
> Why is it not possible? It seems to have been done for other
> languages.

So you don't know for sure? Which implementation specifically
do you think of?

>
>> then you still would need the Tcl interpreter: significant parts of
>> Tk are written in Tcl, so Tk won't work without the Tcl interpreter.
>>
>> However, the Tk API doesn't provide all functionality that Tkinter
>> exposes; many features can only be invoked through Tcl.
>
> True. Were Tcl removed from the equation, then some feautures would
> have to be re-implemented in Python.

You mean, like the key bindings of all the widgets, and the ttk widget
set.

Regards,
Martin
From: Kevin Walzer on
On 6/8/10 6:09 PM, Lie Ryan wrote:
> Much like regex a DSL for matching text, Tcl/Tk is pretty much a DSL for
> creating GUI (anyone knows any real program fully written in
> non-embedded Tcl?).

http://www.amsn-project.net/
http://snackamp.sourceforge.net/
http://www.svi.nl/
http://installbuilder.bitrock.com/
http://www.gidhome.com/
http://www.ellogon.org/

etc.

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
From: Steven D'Aprano on
On Tue, 08 Jun 2010 15:40:51 -0700, geremy condra wrote:

> On Tue, Jun 8, 2010 at 3:09 PM, Lie Ryan <lie.1296(a)gmail.com> wrote:

>> Nobody complains that python included a regular expression engine in
>> its standard distribution; so why complain that python included a Tcl
>> expression engine in its standard distribution.
>
> This is a silly argument.
>
> REs are not full programming languages, even from a theoretical point of
> view,

True, but some theoretical extension to REs could be. If I've understood
correctly, Perl's regexes aren't actually regular expressions any more
(they're a superset) and might even be Turing Complete.

In any case, the point is not that you can or can't write your entire
application using a RE. The point is that regexes are a mini-language, a
DSL, not written directly in Python.

> aMSN is written in Tcl, as wikipedia would have told you, and
> having to depend on the tools of another language to get commonly
> desired functionality is not a good thing for a programming language.

I don't see why you think so. Python is specifically designed to be a
glue language, to bring together functionality from disparate components
written in other languages and provide a user-friendly language around
them. Fundamentally, what's the difference between these?

* CPython relies on Tk/Tcl for a GUI

* CPython relies on a C library for regular expressions

* IronPython relies on the .Net environment for everything

* Jython relies on Java libraries for many things

I don't see why that first one is so much worse than the others. Sure, it
adds an extra dependency to installing Python for GUI programming, but
that's no different to any other GUI toolkit: PyQt has Qt as a
dependency, PyGtk has Gtk as a dependency, etc. (I trust you're not
suggesting that every language needs to create its own fully-independent
GUI toolkit that talks directly to the hardware!)

What does it matter that Tk is Turing Complete and Qt or Gtk aren't?

In any case, if you consider Tkinter is harmful, don't use it. It isn't
like GUI programming in Python relies on it, there are alternatives.



--
Steven