473,769 Members | 2,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Evil, evil wxPython (and a glimmer of hope)

I rarely do GUIs, and reminded myself today why that is the case
(simply, it's not fun).

I implemented a simple TreeCtrl, and had to implement my own 'children'
method, of all things!

Here it is:

def children(self,n ode):
c = []
nc,cookie = self.GetFirstCh ild(node)
while 1:
info = self.GetItemTex t(nc)
c.append((info, nc))

nc, cookie= self.GetNextChi ld(node,cookie)
if not nc.IsOk():
break

return c
And it even fails with zero children. This is as unpythonic as it gets.

However, it should be pretty easy to write small wrapper over the
wxPython api. I'm thinking of wrapping or injecting additional methods
to TreeCtrl that start with lowercase letters and return something
sensible, with reasonable methods. Something like:

root = self.AddRoot("r oot dir") # root is normal wx TreeCtrl root
tree = EasyWx(root) # now tree is our wrapped, more "fun" root
for c in tree.children() :
print c.name

# etc. etc.

This is a bit like Brian Orendorff's "path" module that turns something
low level to something you can use easily, without throwing you into a
world of "frameworks ", toolkits and whatnot. I can see there are things
like Wax or PythonCard, but they are still too "frameworky ", and you
don't use them to extend wxPython, you use *them* and they use
wxPython. I'd basically like to rely on something that is there for the
long haul (plain wxPython API) but only use convenience wrappers *on my
own initiative*, as it seems convenient. Just like I'd use the "path"
module.

wxPython is great as it is (a simple wrapper for a C++ toolkit) and the
basic design is ok & proven, I'm just too lazy to use it in its current
form.

Feb 16 '06
12 1857

vi******@gmail. com wrote:
vi******@gmail. com wrote:
Fuzzyman wrote:
The code is relatively simple - so it would be easy to maintain the
parts you use if that was necessary. Certainly easier than duplicating
it yourself from scratch. :-)


Sounds convincing, I'll give it a shot after all.


Ok, after brief eyeballing & experimenting, it appears that Wax is just
what I was looking for. The code is simple, concise and trivially
understandable, the level of wrapping seems about right, and examples
are helpful.

I'm glad I came whining about this in c.l.py instead of sucking it up
or switching toolkits altogether. :-)


That's good news. I'm about to start using Wax on a couple of
small(ish) projects - so it's nice to know about other users.

All the best,

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml

Feb 17 '06 #11
Hallöchen!

"Fuzzyman" <fu******@gmail .com> writes:
vi******@gmail. com wrote:
vi******@gmail. com wrote:

[...]

Ok, after brief eyeballing & experimenting, it appears that Wax
is just what I was looking for. The code is simple, concise and
trivially understandable, the level of wrapping seems about
right, and examples are helpful.

[...]


That's good news. I'm about to start using Wax on a couple of
small(ish) projects - so it's nice to know about other users.


Has Wax exceeded the critical mass so that one can be quite certain
that it will still be maintained, say, next year? (Sincere question
since I don't know.)

Tschö,
Torsten.

--
Torsten Bronger, aquisgrana, europa vetus ICQ 264-296-646
Feb 17 '06 #12
Torsten Bronger wrote:

Has Wax exceeded the critical mass so that one can be quite certain
that it will still be maintained, say, next year? (Sincere question
since I don't know.)


I was a bit worried about this myself, but after browsing the source I
have to say I'm not terribly so anymore. It's a relatively thin wrapper
over wxPython so you are *almost* using wxPython, but w/o a lot of the
pain & horror, and if Hans Nowak stopped paying attention to it the
maintenance tab could be picked up by someone else rather easily. Also,
wxPython 2.6 is a relatively recent arrival and it's supported, so the
next "breakage point" is relatively far away.

Frankly, I think the time saved by coding for Wax could even exceed the
hypothetical time wasted (in case Wax were discontinued) porting a
finished Wax-using product over to use straight wxPython.

Using Wax (and occasionally peeking at the source) also seems to be a
nice way to learn straight wxPython without being immersed in all the
grossness at once. ;-)

Feb 17 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
2911
by: Grant Edwards | last post by:
Can anybody recommend a good book on wxPython? Are there any books on wxPython? I've been trying to learn wxPython and/or wax for a few weeks, and I'm just not getting it. wxWindows seems to be more low-level than the other GUI toolkits I've used (Tk, GTK, and Trestle), and there are all sorts exposed details in wxWindows/wxPython that I find weird.
25
3357
by: BJörn Lindqvist | last post by:
See: http://www.wxpython.org/quotes.php. especially: "wxPython is the best and most mature cross-platform GUI toolkit, given a number of constraints. The only reason wxPython isn't the standard Python GUI toolkit is that Tkinter was there first." - Guido van Rossum Guess, that answers my question, but isn't "Tkinter was there first" a very bad answer? :) It is kinda ugly too, so I wonder why it can't be replaced? Or maybe another GUI...
12
6497
by: Simon John | last post by:
I'm writing my 2nd large wxPython program, and after the problems I found doing the first's layout in code, I'd like to look at using a 'WYSIWYG' IDE, like VisualStudio does for MFC. I've tried a few that I found, wxGlade is probably the best, although it seems to be not 100% WYSIWYG (like the widgets in the preview are not much like the final program), wxDesigner has a horrid GUI for a GUI designer! VisualWX gave me the 'now what?'...
3
1728
by: writeson | last post by:
Hi all, I'm trying to use wxPython from a fairly new installation of Fedora Core 5. I installed wxPython using yum -y install wxPython and that all seemed to work fine. However, when I run Python and do this: import wx I get this:
4
1416
by: Jive Dadson | last post by:
I hope someone can help me with a couple of wxPython questions, or point me to the right newsgroup for the questions. I am trying to modify the floatcanvas demo program. I want to load an image from a file (jpg or whatever), then do a kind of color-picker action on it. I haven't tried yet to figure out how to load the file. Just for starters, when I click on the canvas, I want to get the rgb pixel value for the point under the...
6
1842
by: BartlebyScrivener | last post by:
If there is a wxPython on Debian user in the house? I am using the version of the demo that came with the apt-get download of wxPython. I thought I'd followed the instructions for installing and unpacking the wxPython demo program. It appears to run after a fashion, but I also get this at the commandline. Any help much appreciated. (python:5865): Gtk-CRITICAL **: gtk_window_realize_icon: assertion
1
1750
by: Benjamin | last post by:
Hello! I am writing a search engine with wxPython as the GUI. As the search thread returns items, it adds them to a Queue which is picked up by the main GUI thread calling itself recursively with wx.CallAfter. These are then added to a ListCtrl. This works fine for small searches, but with larger and longer searchs the GUI is clogged and won't respond. I suspect (I may be wrong) that there are so many results being sent to the ListCtrl...
2
1190
by: ahlongxp | last post by:
Sorry, I know this is not the most appropriate place to talk about wxPython. But I can't have access to wxPython mail list page(because I don't pay enough). I downloaded python2.5 and wxPython 2.8.4.0 from pythonmac.org and installed them into one of my friends' Mac 10.4.8(intel) and I found wx.lib.flatnotebook and wx.xrc were broken(which are quite OK under both Linux and Windows).
1
1848
by: codemania | last post by:
Disappointing me extremely, with the "generate python" function within Resource Editor, I only get a segment of python code which load xrc(xml format) file, rather than real python code in which I could append my own code. Does that mean RE(Resource Editor) is of little use? I hope not, maybe the way I use it is wrong? Tell me please.
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10043
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.