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
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
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. ;-) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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.
|
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...
|
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?'...
|
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:
|
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...
| |
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
|
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...
|
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).
|
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.
|
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,...
|
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...
| |
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| | |