Slashdot Log In
Generic GUI Wrapper For Python
Posted by
timothy
on Sat Oct 27, 2001 06:33 AM
from the operating-systems-shouldn't-matter dept.
from the operating-systems-shouldn't-matter dept.
An Anonymous Coward writes "IBM is working on a generic GUI wrapper to allow Python developers to write cross-platform GUIs. The anygui project will expose a common set of functions to the programmer and choose which backend gui toolkit to use for the given platform: TK, WIN32, GTK, Bethon, etc. Currently the software is in an alpha stage. The article also has some example code." Update: 10/27 23:53 GMT by T : Magnus Lie Hetland wrote to point out that though this article is hosted at IBM, "Anygui has nothing to do with IBM. It is,
in fact, an independent Open Source project currently
hosted at SourceForge."
This discussion has been archived.
No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
WxPython (Score:2, Informative)
David
What about MacOS X? (Score:1)
Anybody know anything about future Python support for the X as well as this anygui?
I like this idea. (Score:1)
random Java flaming again (Score:4, Insightful)
Pretty much all the portability problems with AWT came from the use of native widgets. So, why is Mertz going to repeat the same mistake in his implementation? In fact, it looks like he is going to work hard to make things worse by exposing different APIs on different platforms.
There are a couple of good cross-platform GUIs for Python: FLTK with Python bindings, Fox with Python bindings, and wxWindows (universal or native) with Python bindings. Mertz's project seems like it recreates something whose functionality already exists--a typical case of N.I.H.
awt ? (Score:1, Interesting)
it looks like awt.
awt was replaced by swing because by sticking with
lowest common denominator, you end up with just
very simple (and not very useful) widgets.
Reminds me of my comp sci professor (Score:1)
Someone should try this with perl, it could use a good abstraction layer like this.
Not IBM... (Score:5, Informative)
Also, it's not David Mertz's project, the project leader is Magnus Lie Hetland.
More info: http://anygui.sf.net/
Regards,
Kalle Svensson, PyGTK backend developer.
seems very naive (Score:3)
While you might disagree that Swing is a good solution, the fact remains that Sun realized that all of the above is needed if you want to create competitive GUI apps.
The solution suggested for python seems to make the same design mistakes sun made early on (AWT) and seems to be based on the same naive view on what comprises a good GUI. In addition it seems to ignore a whole lot of other perfectly good solutions (qt, gtk, XUL, Kylix, Swing,
Wrapping is no good solution for anything but the most trivial applications. As soon as you make things more complex, you will have more and more trouble keeping things crossplatform since each platform works slightly different, has its own bugs to work around and may or may not support what you need.
This is not a new GUI toolkit (Score:4, Informative)
This is not a new GUI toolkit. It is a wrapper API for a large number of underlying graphic toolkits. You write code for AnyGUI and don't have to worry what GUI toolkit is used. "On Windows, the Win32 API might be used (or wxWindows); on MacOS, native calls; on BeOS, Bethon; on Linux, TKinter or GTK"
Also, as far as I know this is not an IBM project. The article is just published on an IBM site.
If this works as well as the AnyDBM module which allows basic database access from Python without having to worry about what actual database you are using it will be great.
Check out http://anygui.sourceforge.net/
Won't work (Score:1)
Java tried it, failed.
Netscape tried, failed.
Woot! (Score:1)
Pythons big advantage over Java.... (Score:1)
Python is GPLd. Java is not.
If the other-way-around aproach IBM is taking now is crappy, there be no one stopped from enhancing it or writing a better one. Everyone can go by and rewrite any part of the Standard library if he thinks it's to slow. If IBM wants to bug SUN a little in the "nifty new language concept" dept., this is not the stupidest thing to do.
I'm for it (Score:1)
Now if only PyKDE2 would come out soon, so that I can start making a couple of kicker applets for KDE2. Of course, by the time PyKDE2 is out, KDE3 will have come out, and the whole cycle will start over again!
Listing of available Python GUIs (Score:1)
I love choice, but part of me wishes that more effort would go into getting wxPython/wxWindows polished (and more fully cross-platform) to knock Tkinter from its status as defacto Python GUI.
Not an IBM project (Score:1)
anygui [sourceforge.net] is not an IBM project -- it was just reported on in IBM developer works. If they write an article on java, does it mean they invented java? Sheesh.
From the website:
The purpose of the anygui project is to create an easy-to-use, simple, and generic module for making graphical user interfaces in Python. It's main feature is that it will work transparently with many different GUI packages on most platforms.
You can use it to write a generic GUI app and it will scan the gui toolkits on your box and choose the best one to use for your app.
A successful project with analogous goals is anydbm [python.org]
You can make generic operations on databases, and it will work on mysql and postgresql. It's already a part of the standard python distribution.
wxWindows (Score:2)
I am rapidly becoming a wxWindows [wxwindows.org] fan. I've spent the last week or so learning this toolkit and implementing something like Gamespy or The All Seeing Eye.
I admit this is the first GUI toolkit that I've used (for the desktop), but it seems to be very clear to use. I've got most of the standard functionality down now - events, windows/frames, window sizing, encapsulated string handling, etc, and I've only had to consult the mailing list for a single issue.
I'm using it with C++, but there are some rather popular bindings for Python called wxPython, as well as Perl and an assortment of other languages.
And the thing that gives me wood is that it looks native in each environment. GTK+ with themes under Linux, and Win32 GUI widgets under windows. And yes, it manages to do this without taking the lowest common denominator route: Sometime features like traybar iconifing under Win32 get plainly ignored under other OSes.
Learned a new API this year? (If you are a coder...) If you have not, you're due.
Don't forget about QT! (Score:1)
The only book on Python and QT programming
Not impressed (Score:2)
Anyway, I find it hard to get excited about this toolkit, because it looks to me like a solution waiting for a problem.
Clarifications from the Author (Score:1)
1. I am not the lead developer of Anygui. That honor belongs to Magnus Lie Hetland, who has been doing a wonderful job. As indicated in the article, or on the project page, I -did- volunteer to lead one tiny aspect (but have not yet done any work, for which I apologize).
2. Anygui is not sponsored by IBM. I just write columns for IBM, and found the project interesting enough to devote an installment to.
3. Anygui does not "repeat the mistakes of AWT", nor does it aim to replace another toolkit like GTK or Fox. Anygui is a *wrapper* around lower-end toolkits. The idea is that you can distribute *identical* source code to different users, on different platforms, and have it run with *some* available backend.
4. Anygui will never be as feature-rich as many of its backend toolkits. It is not trying to be. The aim of Anygui is to provide a minimal, but -universal-, GUI API. If you want the full sophistication of, e.g. Swing, don't use Anygui. If you want users of Jython, MacOS native, Win32, and PyGTK (and others) to all be able to receive and run (without modification) your common Python code, Anygui is a brilliant project.
Python is great... (Score:2)
It's like the XML parser model (Score:1)
The idea of a API which provides a way to hook into whatever provider exists on a platform reminds me of the SAX [megginson.com] XML event-driven interface. Right now it does not seem to provide much that an effort to port Tkinter to the "minor" platforms might give you, but maybe in the future it might be able to let a GUI app query the underlying provider whether certain capabilities (e.g. bitmaps on buttons) are supported and make intelligent choices based on that information.
it's not an IBM project (Score:2)
Re:Mmm (Score:1)
(Creator of Perl), 14 Oct 1998
source:
http://www.mindview.net/Books/Python/ThinkingIn
Re:In short, IBM says "Screw you guys, we'll do it (Score:2)
Re:Mmm (Score:2)
Gotta admit that Python is probably the only computing environment I've encountered, which is both easy to learn and powerful in the long run.
The downside is, of course, Python's more restricted syntax. I'd say Python and Perl codes compare like technical manuals and poetry. But when programming I'll rather take the tech (TeX :) route.
Defective O'reilly literature (Score:2)
Re:Mmm (Score:1)
This is what people who have never truly grasped OOP always say. It seams to be 'I don't know how to use it so it must be bad!'. This is, of course, utterly false. OOP projects take a bit longer to create but maintainability and extensablity more then make up for it.
As for the speed issue, that argument was made when programmers moved from C to Assembler. I am sure there are still a few assembler programmers out there saying
'What's this shit with Procedural Programming? PP is a sinking ship, it's been already demonstrated a hundred times that it shows no advantages (except for morons who don't know what they're doing) and is always 5-500 times slower, take C for example.'
So your argument is worthless. I would say pick up and OOP book and spend the next six months or so tring to come up to speed. When the 'Aha' moment strikes you may take back your post.