H
···
Sent via BlackBerry by AT&T
From: wxpython-users+noreply@googlegroups.com
Sender: wxpython-users@googlegroups.com
Date: Fri, 30 Jul 2010 16:41:16 +0000
To: Digest Recipientswxpython-users+digest@googlegroups.com
ReplyTo: wxpython-users@googlegroups.com
Subject: [wxPython-users] Digest for wxpython-users@googlegroups.com - 12 Messages in 7 Topics
Today’s Topic Summary
Group: http://groups.google.com/group/wxpython-users/topics
- wath is better and why [1 Update]
- wxPython app doesn’t work when launched from IPython [2 Updates]
- How to implement something like wx.CallAfter… in the other direction? [2 Updates]
- Are we setting bad examples by placing code logic into event handlers? [1 Update]
- sizers: different borders [4 Updates]
- wxFormBuilder, know anyone? [1 Update]
- IsEnable Broken in FileBrowseButton? [1 Update]
Topic: wath is better and why
Norman Paniagua normanpaniagua@gmail.com Jul 30 11:11AM -0400
^
The wxformbuilder its great, better than the wxglade (its more mature
project) but I have some trouble when I try to compile the wxAdditions (so I
can work with xpython in this rad). I try to compile in Mac OS X 10.6.4 with
the lastet Xcode, if someone has this done in mac I’ll be very thankfull if
they give me a hand or… give me the additions compiled.
Other think, Its a little unstable on this os the wxformbuilder 3.0x, it
closes randomly apparently.
Norman Paniagua
2010/7/28 Ed Leafe edleafe@gmail.com
Topic: wxPython app doesn’t work when launched from IPython
cool-RR cool-rr@cool-rr.com Jul 29 11:18PM +0200
^
Hello,
My wxPython app doesn’t work when launched from IPython. Many people have
IPython set to be their default python
, so when they try to run my app it
shows the widgets weirdly collapsed into each other.
Is this a known problem? Is it solvable?
Thanks,
Ram.
Mike Driscoll kyosohma@gmail.com Jul 30 07:59AM -0700
^
Is this a known problem? Is it solvable?
Thanks,
Ram.
What version of ipython / wxPython? What platform? I just tried
ipython 0.9.1 with a simple wxPython app (2.8.10.1) and it worked fine
on Windows XP.
Do you have a sample app we could try?
Mike Driscoll
Blog: http://blog.pythonlibrary.org
Topic: How to implement something like wx.CallAfter… in the other direction?
Joel Koltner zapwire-groups@yahoo.com Jul 29 10:36PM -0700
^
Hi guys,
I’ve made good use of wx.CallAfter to allow a worker thread to call
quite arbitrary wx functions back in the GUI thread, but to date I’ve
always used very simple-minded techniques to communicate from the GUI
Thread back to the worker thread. (E.g., setting or clearing simple
variables with the assumption that their access is atomic.)
Is there a straightforward way to make something as flexible as
wx.CallAfter that would allow GUI to worker communication? My command
of Python isn’t advanced enough to understand how a function can queue
up an arbitrary number of passed parameters and then provide them back
to a different thread.
I take it wx.CallAfter’s dispatch must actually come from wx’s main
event loop, and therefore a worker thread would have also specifically
check for queued commands regularly, when it was otherwise just going
to sleep, etc.
Thanks!
—Joel
“Frank Millman” frank@chagford.com Jul 30 09:08AM +0200
^
Joel Koltner wrote:
check for queued commands regularly, when it was otherwise just going
to sleep, etc.
Thanks!
One way would be to use python’s Queue module.
Set up a Queue.Queue instance at the top of the program, so that it is
visible to both threads. Alternatively create it in one thread and pass it
as a parameter to the other one.
When wx wants to communicate with the worker thread, it can ‘put’ something
onto the queue.
The worker thread can check if the queue is empty, and if not, ‘get’ the
item and deal with it.
HTH
Frank Millman
Topic: Are we setting bad examples by placing code logic into event handlers?
Kevin Ollivier kevin-lists@theolliviers.com Jul 29 03:45PM -0700
^
Hi Chris,
Wow, sorry, I thought I sent this a long time ago but when I checked I found it was still in my drafts folder.
On Jul 12, 2010, at 3:34 PM, Christopher Barker wrote:
But yes, you are right.
It’s a real pedagogical challenge - you want to be able to show folks how to use a given control without a whole lot of extra code, but then the natural thing for a newbie to do is use that code as a model, and, you’re quite right, end up with spaghetti.
I like mid-size, rather than tiny, examples, but it’s really hard to show good code structure in a small program, no matter how you do it.
I don’t think it often has to be that hard. Most simple cases, like sample code, could be refactored to provide more robust separation of concerns / MVC simply by deriving most of the sample classes from wx.EvtHandler instead of wx.WhateverView, then using self.control.Bind(event, self.myhandler.EventHandler) instead of self.Bind(event, self.EventHandler). e.g. here’s something I did a few months back:
class STCFindReplaceController(wx.EvtHandler):
'''
This class controls Find and Replace behaviors for wxSTC, e.g. adding
"move to selection" behavior and setting up the keyboard shortcuts.
'''
def__init__(self, stc, *args, **kwargs):
wx.EvtHandler.__init__(self, *args, **kwargs)
self.stc = stc
self.searchText = None
self.lastFindResult = -1
self.BindEvents()
def OnKeyDown(self, event):
is_search = event.MetaDown() and event.KeyCode == 'G'
if self.searchText and is_search:
self.DoInlineSearch(self.searchText, next=True)
else:
event.Skip()
def DoInlineSearch(self, text, next=False, back=False):
self.searchText = text
startPos = 0
if self.lastFindResult > 0 and next:
startPos = self.lastFindResult + 1
self.lastFindResult = self.stc.FindText(0, self.stc.GetLength(), text)
if self.lastFindResult != -1:
self.stc.SetCurrentPos(self.lastFindResult)
self.stc.EnsureCaretVisible()
self.stc.SetSelectionStart(self.lastFindResult)
self.stc.SetSelectionEnd(self.lastFindResult + len(text))
def BindEvents(self):
self.stc.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
Then in MyApp.OnInit or wherever appropriate:
self.frame = wx.Frame(None, -1, …)
self.source = wx.stc.StyledTextCtrl(self.frame, -1)
self.findReplaceController = STCFindReplaceController(self.source)
So without hardly any extra code or added complexity at all, I’ve added my own behaviors to a wx.STC control without having to subclass wx.stc.StyledTextCtrl in my app. This way, if I create a new STC control somewhere else in my app, and want it also to have inline search capabilities (but not every other feature the other STC control has), then I don’t need to do things like carefully plan out my subclass hierarchy into a multilayered jumble of MyFullFeaturedSTC, derived from MySTCWithFindReplace, derived from wx.stc.STC or use mixins to do much the same thing with multiple inheritance… I can even dynamically enable / disable the functionality at runtime with a line or two of code. And, if I make the above code Windows-friendly in terms of keyboard shortcuts :), I could submit it to wx as a helper class that would save someone else the trouble of writing the same thing. One or two convenience classes like this won’t make a big deal, but I suspect that over time they
will grow and users will be able to just plug in a lot of advanced behaviors.
Thanks,
Kevin
Topic: sizers: different borders
Robin Dunn robin@alldunn.com Jul 29 12:37PM -0700
^
[[ This group prefers bottom-posting. See
http://idallen.com/topposting.html and
http://www.caliburn.nl/topposting.html ]]
On 7/29/10 10:16 AM, Raoul wrote:
the positioning flags only interact with the padding flags simply by
honoring them. The 2 sets of flags should have had separate arguments
implemented for them.
Perhaps you would prefer using AddF() with wx.SizerFlags instead. For
example:
sizer.AddF(item,
wx.SizerFlags().Proportion(2).Expand().Border(wx.ALL, 5))
–
Robin Dunn
Software Craftsman
Robin Dunn robin@alldunn.com Jul 29 12:37PM -0700
^
On 7/29/10 10:17 AM, Al wrote:
Set the border value for this item.
B) set the other borders to, e.g. 20, or maybe this method can be
called for each side.
No, there is still just one attribute in wx.SizerItem for the border size.
–
Robin Dunn
Software Craftsman
Raoul raoulpalma@yahoo.com Jul 29 12:53PM -0700
^
Thanks, it seems clearer now.
I think that the crux of the issue is that sizers mess with
a .SetBorder effect when all they should be doing is changing the the
visible aspects of the SizerItem and not the invisible border. Direct
manipulation of just positioning can easily produce the appearance of
an invisible border as well as having the ability to create the
appearance of 4 differently sized borders.
Or, I should really say "create 2 differently sized invisible borders
along the axis of that sizer without affecting positioning in any way
along its other axis" ? That would be exactly like automatically
adding .AddSpacer() statements.
Consider that AddSpacer() can’t affect spacing along the opposite axis
of the sizer. So, why should “padding=n” be allowed to do so ? That’s
just not the best way to go about doing things ! I have to consider
this ability to be a “bug” and not at all a worthwhile “feature”.
Thanks again for your replies.
Ray
Cody Precord codyprecord@gmail.com Jul 29 03:14PM -0500
^
Hi, (please again is there some technical reason that we cant do
bottom posting here?)
of the sizer. So, why should “padding=n” be allowed to do so ? That’s
just not the best way to go about doing things ! I have to consider
this ability to be a “bug” and not at all a worthwhile “feature”.
AddSpacer is a convenience function, it is equivalent to the below.
AddSpacer(10) == Add((10, 10), 0)
Which to reiterate again would also be equivalent to:
item = wx.SizerItem()
item.SetSpacer(wx.Size(10, 10))
item.SetProportion(0)
sizer.AddItem(item)
Though it would make little sense to do so you can add a spacer that
has a border using the Add function if you wanted.
Add((10, 10), 0, wx.ALL, 10)
Would add a blank rectangle of 30x30px to the layout.
Cody
Topic: wxFormBuilder, know anyone?
Michael Hipp Michael@Hipp.com Jul 29 02:51PM -0500
^
I downloaded wxFormBuilder [1] and am fairly impressed with it. But I tried to
register on the forum and the issue tracker with no luck. (The registration
system seems unable to send a confirmation email; I’m not the only one saying so.)
The whole site has a dearth of contact options presented. I sent an email to a
developer but wondered afterward if that was the best plan.
Anyone here know an admin who can perhaps work on their forum or issue tracker?
Thanks,
Michael
[1] http://forum.wxformbuilder.org
Topic: IsEnable Broken in FileBrowseButton?
Robin Dunn robin@alldunn.com Jul 29 12:37PM -0700
^
On 7/29/10 11:15 AM, yoav glazner wrote:
Cody
Yea, that’s what I do for now as a monkey patch, Can someone with
commit privilege patch so in the next version it will be fixed?
Already done, although not committed yet.
–
Robin Dunn
Software Craftsman
–
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en