GUIs - A Modest Proposal

R

rantingrick

<original>
To quote R. David Murray on the Python bug tracker earlier today.

"Everyone who uses IDLE uses TKInter

Thats a grossly general statement although it *is* a fact. Heres
Another: "Everyone who uses Tkinter uses Python"... and the point
is????
and a lot of people use IDLE."

"A lot"? How many is "a lot" David. If you're going to present the
group with such general ways of measuring value then at least give us
a mapping so we can translate it into something tangible. Can you
express "a lot" in the form of an integer? And where is the proof that
supports this value "A Lot".

Hmm, I know *I* use IDLE so thats *one* person. However blabbing hear-
say like some old lady at a hair salon is a non starter because it has
no fact-based-foundation in reality, and so renders the argument
completely inadmissible and quite frankly makes you look incompetent.
Sadly however (in this group it seems) hearsay and hyperbole run a-
muck on a daily basis.

Release the ModuleRemovalWarning and you WILL then get back reliable
information as to who *IS* and *IS NOT* wishing Tkinter to stay. But
you won't do this because your afraid of being proven wrong. I would
happily love to be proven wrong, WITH FACTS AND NOT HEARSAY THAT IS!.
If the numbers are for keeping Tkinter then I will jump full-force
into Tkinter/IDLE development. I already have many patches and
improvements for both Tkinter and IDLE working nicely on my machine.

Run the warning. Then and *only* then can we move forward with facts.
Or you could just keep living in your self-aggrandizing fantasy world
of "I'm always right and everyone else is the moron".
 
G

geremy condra

Thats a grossly general statement although it *is* a fact. Heres
Another:  "Everyone who uses Tkinter uses Python"... and the point
is????


"A lot"? How many is "a lot" David. If you're going to present the
group with such general ways of measuring value then at least give us
a mapping so we can translate it into something tangible. Can you
express "a lot" in the form of an integer? And where is the proof that
supports this value "A Lot".

Hmm, I know *I* use IDLE so thats *one* person. However blabbing hear-
say like some old lady at a hair salon is a non starter because it has
no fact-based-foundation in reality, and so renders the argument
completely inadmissible and quite frankly makes you look incompetent.
Sadly however (in this group it seems) hearsay and hyperbole run a-
muck on a daily basis.

Release the ModuleRemovalWarning and you WILL then get back reliable
information as to who *IS* and *IS NOT* wishing Tkinter to stay. But
you won't do this because your afraid of being proven wrong. I would
happily love to be proven wrong, WITH FACTS AND NOT HEARSAY THAT IS!.
If the numbers are for keeping Tkinter then I will jump full-force
into Tkinter/IDLE development. I already have many patches and
improvements for both Tkinter and IDLE working nicely on my machine.

Run the warning. Then and *only* then can we move forward with facts.
Or you could just keep living in your self-aggrandizing fantasy world
of "I'm always right and everyone else is the moron".

I'm currently doing an analysis of pypi data to see what modules are being
used and how much. If you're so interested in knowing how widely used
tkinter is, please contact me- we could certainly use some additional
processor time.

Geremy Condra
 
S

Stephen Hansen

Run the warning. Then and *only* then can we move forward with facts.

http://google.com/codesearch?q="from+Tkinter+import"
http://google.com/codesearch?q="import+Tkinter"

Compared to:

http://google.com/codesearch?q="from+wx+import"
http://google.com/codesearch?q="import+wx"

and

http://google.com/codesearch?q="from+PyQT4+import"
http://google.com/codesearch?q="import+PyQT4"


-1; This most trivial and unreliable of metrics is, despite its limited
effectiveness, enough alone to show that there is sufficient usage of
Tkinter to argue against removal without a compelling replacement being
available and a migration path available for those who used Tkinter
before to make use of this replacement.

There is neither a compelling replacement ready yet (though PyGUI may
become one, sure) nor any migration path available ('just download
tkinter from pypi' is not sufficient)

--

Stephen Hansen
... me+list/python (AT) ixokai (DOT) io


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)

iQEcBAEBAgAGBQJMEqXRAAoJEKcbwptVWx/lnx8H/i6HMPKuz2iGnpjHJ1WLDHDz
WhULi6G6Tgu7C3yv7m+xz0lqsdrxaWsSDP8zgf+jelGaW6HfJPR56aoBH6L+U/lV
jXXPi4tYdhpq6ENq0+r1T1DIiGcwvbrrJUcV7fPWeaTc2Mvs1/u2XrlWF/x4YQ+w
qq9UkX4Nczv1BrorihFxSRdy/uvw8wO/VyUDT5qB4EDRbvrGXfWxke9HsQOiSjbU
ZCMel728JrbwY9OUAMs2Yc8wCq3KHLJCA6z6llB8TnpfRDs1oNb2prSwuU+zugAg
2C4199/HhMUDluE5Th/8zP/CDnI7TYa9L7T1UHFLGqU3WU6zapDHIHkdaO4sh+A=
=hqZA
-----END PGP SIGNATURE-----
 
R

rantingrick

http://google.com/codesearch?q="from+Tkinter+import"http://google.com/codesearch?q="import+Tkinter"

Compared to:

http://google.com/codesearch?q="from+wx+import"http://google.com/codesearch?q="import+wx"

and

http://google.com/codesearch?q="from+PyQT4+import"http://google.com/codesearch?q="import+PyQT4"

-1; This most trivial and unreliable of metrics is, despite its limited
effectiveness, enough alone to show that there is sufficient usage of
Tkinter to argue against removal without a compelling replacement being
available and a migration path available for those who used Tkinter
before to make use of this replacement.

There is neither a compelling replacement ready yet (though PyGUI may
become one, sure) nor any migration path available ('just download
tkinter from pypi' is not sufficient)


Fair enough! Although whether or not we want to remove Tkinter i think
it would be a good idea to get some feedback. But alas i am tired of
fighting with you guys about it.

So, since we are *keeping* Tkinter i want some suggestions for
improvement. And don't go telling me that nothing needs fixing,
because i have documented time and again the problems in Tkinter and
IDLE. I have already made patches/fixes for some of them but somehow i
fear the *in crowd* will never accept my changes just from pure spite.

So let me hear of ANY improvements and/or suggestions for Tkinter/IDLE
docs, code, or whatever.
 
M

Mark Roseman

So let me hear of ANY improvements and/or suggestions for Tkinter/IDLE
docs, code, or whatever.

Why don't you modify the IDLE code to use the newer ttk widget set,
rather than what its using now? You'd be surprised at how much
difference you'll see.
 
G

Gregory Ewing

Steven said:
This
reminds me of time-travellers suffering from "time lag" in the wonderful
novel "To Say Nothing Of The Dog" by Connie Willis.

One of the many excellent reasons why Guido keeps tight
control over the keys to his time machine. Time-lagged
joyriding teenagers careening around the space-time
continuum can be quite a hazard.
 
S

Steven D'Aprano

One of the many excellent reasons why Guido keeps tight control over the
keys to his time machine. Time-lagged joyriding teenagers careening
around the space-time continuum can be quite a hazard.

Imagine the havoc if RantingRick accidentally goes back in time and
deactivates the Timbot.
 
S

Stephen Hansen

Except, apparently, use it from another module in the stdlib. :-(

Yeah. I get the policy in general, a proliferation of ctypes stuff could
be very bad -- but if code is very careful with type-checking and stuff,
it should be possible to get an exception, I'd hope.

Otherwise it makes certain windows-workarounds very problematic. You
basically /have/ to write a C extension :|

--

Stephen Hansen
... Also: Ixokai
... Mail: me+list/python (AT) ixokai (DOT) io
... Blog: http://meh.ixokai.io/


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)

iQEcBAEBAgAGBQJMEwBTAAoJEKcbwptVWx/lC14IAKh4JOOATUWvf8SoriIH87TI
nE7oHQyB68d3wovBVzH8I7OXHebYSUiH0Q6P50idwsV2+Z0U7La+ki7L0Z3MFP/E
D4J1zTdPZ+vHGoDzZD7vIYVPxjOjMnz5oNaXas5HpPErIHPU3fgKN6x5d+x/q6gV
HuyVzm8jyKbQMsQrWHuLVNzuyQ9RVm5BguNY8Wh8z4HdyT0v/ujScHnu7cIPpotJ
gBr1YmbqSR3Ze2PeS6hom0U36siIPzoAD6IwQVes27FbH8MYipnk7PiOzbo8MAu1
rq/X/EvRL7QbHSw4apCUALFeRkmzl02L3QO3osaIBXtFTy99643bSL7j+yd9YrE=
=ZOvK
-----END PGP SIGNATURE-----
 
M

Mark Lawrence

Imagine the havoc if RantingRick accidentally goes back in time and
deactivates the Timbot.

Not a chance, if Dr Who can take on baddies like the daleks, yetis and
cybermen Ranting Rick would be a piece of cake. :) My 13 year old will
be glued to BBC1 tonight at 18:45 BST to see his hero (Dr Who that is)
in action.

Down with baddies.

Mark Lawrence.
 
M

Martin v. Loewis

Yeah. I get the policy in general, a proliferation of ctypes stuff could
be very bad -- but if code is very careful with type-checking and stuff,
it should be possible to get an exception, I'd hope.

Only if you can live with the respective module not being available all
the time.

The issue is not that you may mistakes in the ctypes code, thus allowing
users to crash Python. The issue is that if users remove ctypes (which
they may want to do because it's not trustworthy), then your module will
stop working (unless you have a fallback for the case that ctypes is
unavailable).

In general, it's undesirable that absence of some module causes a
different module to stop working in the standard library, except that
absence of Tkinter clearly causes IDLE and turtle to stop working.
Otherwise it makes certain windows-workarounds very problematic. You
basically /have/ to write a C extension :|

That's not problematic at all, for the standard library. Just write that
C extension.

Regards,
Martin
 
M

Martin P. Hellwig

On 06/12/10 08:21, Martin v. Loewis wrote:
The issue is not that you may mistakes in the ctypes code, thus allowing
users to crash Python. The issue is that if users remove ctypes (which
they may want to do because it's not trustworthy), then your module will
stop working (unless you have a fallback for the case that ctypes is
unavailable).
<cut>
Got me thinking, is it perhaps doable to have a 'safe' ctype that is
guaranteed to be in the stdlib? Perhaps crippling it in a sense that it
only allows a known set of functions to be called?
My gut feeling is that you open a can of worms here but I would
appreciate your opinion.
 
M

Martin v. Loewis

Got me thinking, is it perhaps doable to have a 'safe' ctype that is
guaranteed to be in the stdlib? Perhaps crippling it in a sense that it
only allows a known set of functions to be called?

In some sense, a C module wrapping a selected number of functions
(like the win32 extensions) is exactly that.

Notice that it's not (only) the functions itself, but also the
parameters. It's absolutely easy to crash Python by calling a function
through ctypes that expects a pointer, and you pass an integer. The
machine code will dereference the pointer (trusting that it actually is
one), and crash.

Regards,
Martin
 
B

Bryan

Martin said:
Martin v. Loewis wrote:


<cut>
Got me thinking, is it perhaps doable to have a 'safe' ctype that is
guaranteed to be in the stdlib? Perhaps crippling it in a sense that it
only allows a known set of functions to be called?
My gut feeling is that you open a can of worms here but I would
appreciate your opinion.

Perhaps instead of restricting what functions ctypes can use, we could
restrict what modules can use ctypes. For example, maybe only modules
in certain directories should be allowed to import ctypes.
 
M

Martin v. Loewis

Perhaps instead of restricting what functions ctypes can use, we could
restrict what modules can use ctypes. For example, maybe only modules
in certain directories should be allowed to import ctypes.

And that's indeed the case. The test suite may use ctypes.

Regards,
Martin
 
L

lkcl

[ye gods, i think this is the largest thread i've ever seen, but i
still feel compelled to wind back to the beginning and spew forth
words.]

I get the strong feeling that nobody is really happy with the state of
Python GUIs.

yep. that's why i ported pyjamas, which was a web-only/browser-only
UI toolkit, to the desktop. it's a _real_ eye-opener to try to use
the "failed" ports of pyjamas to both pygtk2 and pyqt4, which you can
still get at http://github.com/lkcl/pyjamas-desktop - see pyjd-pyqt4
and pyjd-pygtk2

these failed ports give you the clearest and bluntest indication of
the failings of pyqt4 and pygtk2. after using those two "top"
mainstream python GUI widget sets, i didn't try any others.
Whether or not we like graphics programming, it's not going to go
away.

no you're right, it's not.

... but as web browser technology development continues to
accelerate, the top mainstream GUI technology (not just python GUI
technology) is going to look more and more archaic in comparison.
I ask the group; should we try to create a new GUI for Python, with
the following
properties?:

- Pythonic
- The default GUI (so it replaces Tkinter)
- It has the support of the majority of the Python community
- Simple and obvious to use for simple things
- Comprehensive, for complicated things
- Cross-platform
- Looks good (to be defined)
- As small as possible in its default form

i invite anyone considering starting a new python GUI project to
consider these questions:

* how much effort has been and is being spent, right now, on
developing and debugging each of the python GUI widget sets, as
compared to the efforts on web browser technology (MSHTML, KHTML ok
maybe not kHTML, WebKit, XulRunner)? (put another way: how long have
web browsers existed and how much user-market-share do web browsers
have, compared to GUI and python GUI widget sets?)

* are python GUI widget sets easy to compile cross-platform, as
compared to web browser technology which is _definitely_ cross-
platform?

* how easy is it to extend the existing python GUI widget sets with
"new" or "custom" widgets, as compared to web browser technology where
you can manipulate bits of DOM? if you're not sure of how simple/
complex each task is, read and compare these:

http://www.learningpython.com/2006/07/25/writing-a-custom-widget-using-pygtk/
http://pyjd.sourceforge.net/controls_tutorial.html

* how easy is it, using the "new" or "custom" widget extension
methodology of existing python GUI widget sets, to extend that widget
set to "keep up" with modern GUI advancements and user expectations,
as compared to enhancing web browser technology?

actually, this is a deliberately misleading question, but it at
least illustrates that it's damn hard for GUI widget set developers to
"keep up". in fact, many GUI widget set developers are actually
embedding web browser technology as a widget in order to avoid the
problem! (pywebkitgtk, pyqtwebkit etc.)

* better question: how much time and money by large corporations with
their associated vested interests is being invested into python GUI
widget sets, as compared to how much by those same corporations into
the W3C DOM Standards process and the resultant improvements and
advances in web browser technology?

* final question: how easy is it to create python "wrappers" around
DOM browser technology, thus leveraging and riding on the back of the
_vast_ amounts of effort and money being poured into web browser
technology?

answer for MSHTML (aka Trident Layout Engine): using python-comtypes
- 3 weeks.

answer for WebKit: using glib/gobject and pygobject "codegen" to
augment pywebkitgtk - 12 weeks

answer for XulRunner: using python-hulahop and python-xpcom - 2
weeks.

answer for Opera's engine: unknown, because the developer hasn't
responded yet. (it's qt-based, so it would be estimated around 12
weeks, if they haven't already done the work).

so can you see where this is at? and that's why pyjamas/pyjamas-
desktop exists. a _completely_ non-corporate-funded, _tiny_ team is
riding on the back of the vast amounts of money and resources
available to google, apple, nokia, microsoft, mozilla foundation and
so on, and we're sitting back and offering it as free software to
people to create applications that are as powerful as the underlying
web technology on which the pyjamas UI toolkit is based.

and with the addition of WebGL (3D SVG) and HTML5 (Video etc.), web
technology is becoming pretty powerful.

so this is why it can be claimed that pyjamas competes with
silverlight and with adobe AIR/Flash, and it's not to do with pyjamas
"per se": pyjamas is just a "leveraging" technology to get at the
underlying power of the web engines. (the claim _does_ however grate
against a lot of egos, somewhat understandably, and with a non-
existent "marketing dept" there's not a lot that can be done about
that).

so let me go over these points again, now wrt pyjs/pyjd "in the frame"
so to speak.
- Pythonic

yep it is. definitely. part of the reason why pyjamas is 1/10th the
size of GWT is thanks to the dynamic nature of python.

another reason is that we simply left out vast tracts of GWT code
(such as thousands of lines of GWT "internationalisation" support) but
that's another story.
- The default GUI (so it replaces Tkinter)

can't answer that one.
- It has the support of the majority of the Python community

_definitely_ can't answer that one :) but i'm betting that, without
reading them, a good 80% of the 222-long discussion so far is in
response to this point :)
- Simple and obvious to use for simple things

pyjamas is blindingly so. helloworld in 5-6 lines, just like pygtk.
async event handling and well-defined event-receiving functions. etc.
etc.
- Comprehensive, for complicated things

yep. you only have to look at the GWTCanvas examples or the GChart
2D graph/barchart source code (19,000 lines!) to see how "simple" DOM
manipulation can turn into comprehensive applications.
- Cross-platform

definitely. cross-platform, cross-widget-set _and_ cross-browser,
because, last resort, if users refuse to install pyjamas-desktop, you
can always compile the exact same application to javascript and run it
in every single major modern web browser.

... can pygtk2, pyqt4, TkInter or wxWidgets claim to be cross-
browser? can you recompile a pygtk2 or pyqt4 application and run it
in a web browser, as javascript (actually, there _is_ a
reimplementation of pygtk2 for pyjamas, it was a GSoC 2007 experiment
- about 20-30% completed port of pygtk2 widgets, but it proved the
point)
- Looks good (to be defined)

that's up to, and entirely under the control of, the developer.

i.e. it's up to the developer to make use of CSS styles and in some
instances bits of HTML to "prettify" the application, and perhaps
makes use of some of the more decorative panels (DecoratorPanel,
CaptionPanel) in combination with some round-curved images and
associated CSS stylesheet.

other than that, the application "looks as good as" the underlying web
browser engine "default" styles. which can be pretty boring, but
that's life, and it's why CSS stylesheets exist. which normal desktop
GUI widget sets of course can't make use of.
- As small as possible in its default form

pyjamas is pretty damn small, and it's pure python. there's no c
code involved in the actual pyjamas codebase [and probably never will
be].

the main UI library used to be one 4,000-line file: i got fed up with
that and split it into 70 separate modules (one per widget/class) and
the repetition of the license text increased it to 6,500 lines (!).
since that time, about a year ago, the UI code has expanded to about
9,000 lines, with the addition of some GWT-ported widgets, contributed
by users as GWT itself has developed.

the pyjd DOM "wrapper" technology (which is responsible for creating
a window and firing up the users' app under each of the three pyjd
ports) is a total of 4,000 lines, but you don't need to know anything
about that: it's just a "tool". i mention it out of sheer fascination/
horror as to how to leash and tame a behemoth (such as a W3C DOM
compliant browser engine).

the pyjs compiler used to be 1200 lines, and is now 4,000 - but
again, it's a specialist "tool" that has _nothing_ to do with the UI
toolkit itself: you just use it, just as you use "gcc" and don't
include "gcc" itself as part of your application.

so, i hope that i'm steering you away from considering creating yet
another python GUI widget set, and i leave you with this irony: the
pyjamas desktop ports, thanks to their browser engines, actually use
"raw" Win32 GDI in the case of the MSHTML port; GTK in the case of the
xulrunner port; and GTK again in the case of the pywebkitgtk port.
there _is_ a pywebkitqt4 experimental port as well but the DOM
bindings to pywebkitqt4 are virtually non-existent: you have to
actually use and execute javascript code-fragments (from python
*shudder*, *quiver*) and try to prise the resultant bit of DOM out of
the JS engine's cold, dead fingers, and create a proxy class to
nurture it back to life in the python world. but, as far as pyjamas
developers are concerned, all that is completely irrelevant: you just
"get on with it".

l.

p.s. come along to http://europython.eu 19-24 july 2010, birmingham,
UK.
 
L

lkcl

These goals are not all complementary. In fact, some of them, such as
"small" and "comprehensive," are mutually exclusive.

that's not quite true - you can create a simple core which is easily
extensible with third party contributions to create more comprehensive
widgets.

in the GWT arena, you have gwt-g3d, gwt-incubator, gwt-gchart and so
on, all of which were created very easily thanks to the power of the
underlying GWT core codebase, _none_ of which are actually included
into GWT by default, _all_ of which can be installed by users and
simply "imported" just like the core.

now s/GWT/pyjamas and you have the exact same thing, and all the
satisfiable requirements are met.

l.
 
L

lkcl

<snip...>

What an interesting set of responses I got!
And - even more interesting - how few of them actually seem to think
there is a problem, let
alone make any attempt to move the situation forward.
I appreciate that there are proponents of many different GUIs. I am
asking that all step back
from their particular interests and - for example - try to see the
situation from the viewpoint of
- say - a Python newbie, or an organisation that is thinking of
switching from (example only!) Visual Basic.

I obviously didn't make my main point clearly enough; I'll restate it
with a different emphasis:
The default GUI shipped with Python is Tkinter.
Few people seem to like it much. This has several consequences.
- It has not blossomed, like Python has.
- There are not hundreds of talented programmers making rapid and
impressive improvements to it.
- Books about Python use it in examples (because it IS the default),
but imply that one should move on.

The result that our hypothetical new recruit has to make a choice for
the new, big project. Remember that
GUIs have hundreds (sometimes thousands) of classes, functions and
constants. Let alone idioms and design
patterns. That is what I meant by 'Our resources are being
dissipated'; the effort of learning, remembering
and relearning a workable subset of these is substantial.
So it would be good to be able to use One Right Way, not try several
(as I have - I will admit I didn't try PyQt;
GUI fatigue was setting in by then).

If we are to make progress, I can see two obvious approaches:
1) Improve Tkinter to the point where it is supportable and supported
by a good fraction of Python programmers
or
2) Drop Tkinter as the default and use something else.

If we choose 2) then we have a new set of possibilities:
2a) Use one of the 'major' GUIs, pretty much as is, but presumably
with a lot more people supporting it if it is the default.
2b) Use one of the 'minor' GUIs, and get a lot of people working on it
to make it really good.
2c) Start from scratch. With a project supported by the Community as a
whole, with the agreed objective of being the default.

None of these is easy. All require strong leadership and great
committment.

What surprises me is the apparent willingness of the Python community
to let this issue slide.

ah - i think... i believe you may be confusing realism with
fatalism. experienced python developers are also experienced,
specialist c programmers (amongst other things) and experienced
software engineers. they've been around a while (10+ years). they
_know_ how much effort is involved in creating a major project such as
a GUI widget set (and you can get a wildly-wrong but nevertheless
useful answer from ohloh.net statistics, by going to http://ohloh.net/p/gtk
for example)

so, spec'ing it out, we _know_ that to create a decent GUI widget
set, from scratch, in c (to make it fast enough) would be... ye
gods... 50 man-years of effort, minimum? you _might_ be able to
reduce that by using somebody else's library (libcairo, libpango)
but... just... _why_??

so this was why i went "f*** that!" and "leveraged" web browser
technology, jumping from virtually nothing (an abandoned python-to-
javascript compiler project) to a world-class GUI toolkit, in under 18
months of _part time_ effort.
My concern is simple: I think that Python is doomed to remain a minor
language unless we crack this problem.

ah. take a look at that chart that keeps cropping up every now and
then: python is _not_ a minor programming language. most likely due
to django, it's rated about 7th with about ... i think it was 6%
share. perl is now _under_ 4%!

so i don't believe there are any concerns there: python has enough
alternate uses other than as a GUI toolkit to keep it going :)

l.
 
L

lkcl

Terry Reedy schrieb:
Forget postscript!
Generate SVG from  a tk canvas or --better-- from tkpath.
Jeszra (from me) generates SVG. There is also a SVG export

... orr, you use a modern web browser engine such as XulRunner 1.9
(the engine behind FF 3+), or webkit (the engine behind arora, midori,
safari, android, chrome, palm's webos, adobe AIR, iphone, ipad,
appcelerator, nokia S60 browser, the IE chrome plugin, blackberry 4
OS's web browser, and god knows what else).

and you create python bindings to that modern web browser engine, and
you can then use DOM manipulation (like javascript, only in python) to
get at those SVG functions, and much much more.

... how does that sound?

Will any big GUI-Framework work on those devises?

No!

yes. called a web browser. most likely a modern webkit-based
engine.
Will SVG run on thoses devices?

yes. in the webkit-based web browser. or the "opera mini" browser.
etc. etc.

l.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top