Re: [wxPython-users] Digest for wxpython-users@googlegroups.com - 6 updates in 4 topics

19 views
Skip to first unread message

Digest recipients

unread,
Apr 16, 2017, 12:29:15 PM4/16/17
to wxpytho...@googlegroups.com
Andrea Gavana <andrea...@gmail.com>: Apr 15 05:15PM

Hi,
 
On Sat, 15 Apr 2017 at 18:20, franz steinhaeusler <
> How can I get windows to deliver *ALL* Characters in the Listbox? Is there
> any style for that? I there any workaround?
 
> Many thanks in advance!
 
 
 
It appears it cannot be done:
 
https://msdn.microsoft.com/en-us/library/79kywsae(v=vs.110).aspx
 
Although I'm no super expert and I may have missed some info. If it can't
be done, then you might want to give UltimateListCtrl a try, I am sure
there is no such limitation in there...
 
By the way, why would you need to display 700 characters in a listctrl
item? Even if you do, the column width must be something like 2,000
pixels...
 
Andrea.
 
 
 
 
franz steinhaeusler <franz.ste...@gmail.com>: Apr 16 07:35AM -0700

Hello Andrea,
 
first I was away some years from wxPython, I need to come into it again.
 
My app is a clipboard manager like clipx on windows or parcellite on
ubuntu, which I want to have crossplatorm.
 
I have ported the EditableListbox from wxWidgets Source to python and here
I have my problems with the listctrl.
With the editableListbox, I want to view/edit clipboard (and also
"snippets" entries. And some clipboard data entries are quiet long.
I want to have Tooltips in Listctrl to view the content and I have an edit
button (which calls a dialog with stc Editor) to comfortable edit the entry.
 
 
I have already tried your UltimateListCtrl and SuperTooltip (which is a
fantastic work from you), but I had some problems/inconsistencies. Maybe I
try again, but I think I would have to patch some of your Sources.
Ryan Holmes <ryan.x...@gmail.com>: Apr 15 02:17PM -0700

This sounds like it would take a large refactoring of the code, and would
require changes to each place that binds to that event. I was hoping to
avoid a large refactor (the project is fairly large) and instead utilize
the existing PostEvents and Binds, but add this additional requirement of
having another event actually release the events to those areas that bind
to it. Perhaps I'm not fully understanding your suggestion though. I'll
read up a bit more on event handling and pubsub, but would like to hear
about any other possible solutions that may be available. :)
 
On Saturday, April 15, 2017 at 1:25:22 AM UTC-4, Gadget Steve wrote:
Steve Barnes <gadge...@live.co.uk>: Apr 16 07:03AM

On 15/04/2017 22:17, Ryan Holmes wrote:
> understanding your suggestion though. I'll read up a bit more on event
> handling and pubsub, but would like to hear about any other possible
> solutions that may be available. :)
 
Rather than trying to modify the underlying framework behaviour, by
getting it to postpone event processing it is much easier to bind all of
the existing events to a handler that queues the request, with the
control ID and possibly the event type and then have a single handler
for the get on with it event that could use a look up of the original
event handlers for the controls & events and call them as the queued
events pop off of the queue. You could even move the body of each
current event handler to a new function and replace the content with a
call to an add_to_queue with the new function in it then your binds
would not change.
 
--
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.
Digest recipients <sreht...@gmail.com>: Apr 15 01:15PM -0700

=============================================================================
Today's topic summary
=============================================================================
 
Group: wxpytho...@googlegroups.com
Url:
https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/wxpython-users/topics
 
 
- wxListCtrl and GetItemText on Windows limits string length to 511 [2 Updates]
http://groups.google.com/group/wxpython-users/t/1568fd9d149b6fbf
- fully populating GridCellAttr()?? [1 Update]
http://groups.google.com/group/wxpython-users/t/d24836c0e3d6e248
- How to pause an event until another event happens [2 Updates]
http://groups.google.com/group/wxpython-users/t/b86fd7a37b0e462
- Digest for wxpytho...@googlegroups.com - 7 updates in 3 topics [2 Updates]
http://groups.google.com/group/wxpython-users/t/5e844ef97601ca2d
 
 
=============================================================================
Topic: wxListCtrl and GetItemText on Windows limits string length to 511
Url: http://groups.google.com/group/wxpython-users/t/1568fd9d149b6fbf
=============================================================================
 
---------- 1 of 2 ----------
From: franz steinhaeusler <franz.ste...@gmail.com>
Date: Apr 15 09:20AM -0700
Url: http://groups.google.com/group/wxpython-users/msg/265eee06d6692
 
Hello, after a longer research, I found the problem in my application:
On gtk, everything is fine (no string length limit)
 
But on Windows, if I set a string of length > 511, the string in
GetItemText is truncated to 511 characters (or 512 characters, with 0 Byte
on the end?)
 
small example in pycrust Windows:
>>> l=wx.ListCtrl(c)
>>> l.InsertStringItem(0, "h"*700)
0
>>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hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
700
 
If I can solve that problem (I use the EditableListBox), I cannot really
use my app on windows (without any serious change).
How can I get windows to deliver *ALL* Characters in the Listbox? Is there
any style for that? I there any workaround?
 
Many thanks in advance!
 
 
---------- 2 of 2 ----------
From: franz steinhaeusler <franz.ste...@gmail.com>
Date: Apr 15 09:23AM -0700
Url: http://groups.google.com/group/wxpython-users/msg/26622e21d23b9
 
Forgot to mention: Python 2.7, wxPython 2.8.12.1 (same on windows and on
ubuntu)
 
 
 
=============================================================================
Topic: fully populating GridCellAttr()??
Url: http://groups.google.com/group/wxpython-users/t/d24836c0e3d6e248
=============================================================================
 
---------- 1 of 1 ----------
From: Steve Barnes <gadge...@live.co.uk>
Date: Apr 15 05:29AM
Url: http://groups.google.com/group/wxpython-users/msg/2426ac68c73c8
 
> Lesson - always remember to look at both wxPython and wxWidgets docs.
 
I have found that the Phoenix docs are a lot better on this than the
original wxPython documents. If the is a specific area that is missing
it might be worth raising a ticket on the Phoenix documents so as to
keep track of what the problems might be.
 
--
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.
 
 
 
=============================================================================
Topic: How to pause an event until another event happens
Url: http://groups.google.com/group/wxpython-users/t/b86fd7a37b0e462
=============================================================================
 
---------- 1 of 2 ----------
From: Ryan Holmes <ryan.x...@gmail.com>
Date: Apr 14 09:13PM -0700
Url: http://groups.google.com/group/wxpython-users/msg/23e49c730ea8b
 
Hi there,
 
I have an event that is scattered throughout my program. Whenever we make a
change that is committed to the database, we fire off a ModelChanged event
that includes various information, which is then picked up by a variety of
GUI elements to update the screen. However, I'm doing a bit of refactoring
on how this is working. Instead of the GUI elements capturing the event as
soon as it's fired, I wish to pause it until another event happens. So,
instead of doing this:
 
 
Fire Event -> Bindings receive event
 
 
I want it to do this:
 
 
Fire Event -> Wait for another separate event to fire -> Bindings receive original event.
 
 
Here is some code:
 
 
import wxversion
wxversion.select(['3.0', '2.8'])
import wx
import wx.lib.newevent
 
OriginalEvent, ORIGINAL_EVT = wx.lib.newevent.NewEvent()
ReleaseEvent, RELEASE_EVT = wx.lib.newevent.NewEvent()
 
class MyFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, title=title, size=(200,100))
 
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.fireOriginalBtn = wx.Button(self, wx.ID_ANY, "Fire Event")
self.fireOriginalBtn.Bind(wx.EVT_BUTTON, self.fireOriginal)
 
self.releaseEventBtn = wx.Button(self, wx.ID_ANY, "Release Event")
self.releaseEventBtn.Bind(wx.EVT_BUTTON, self.releaseEvent)
 
self.sizer.Add(self.fireOriginalBtn, 1, wx.EXPAND)
self.sizer.Add(self.releaseEventBtn, 1, wx.EXPAND)
 
self.SetSizer(self.sizer)
self.SetAutoLayout(1)
self.sizer.Fit(self)
 
self.Bind(ORIGINAL_EVT, self.captureOriginal)
self.Bind(RELEASE_EVT, self.captureRelease)
self.Show(True)
 
def fireOriginal(self, evt):
wx.PostEvent(self, OriginalEvent(myInfo=[1,2,3,4]))
 
def releaseEvent(self, evt):
wx.PostEvent(self, ReleaseEvent())
 
def captureOriginal(self, evt):
print "Event captured"
 
def captureRelease(self, evt):
print "Release captured"
 
app = wx.App(False)
frame = MyFrame(None, 'Small editor')
app.MainLoop()
 
 
Currently, when you click Fire Event, you'll get text printed to the console. I want to be able to click the "Fire Event" button, but wait until I click the "Release Event" button before my frame gets the original event and prints to console.
 
 
I don't know enough about how to write my own event classes - maybe there's some things I can override to tell it when to emit the event or not, and a cursory look didn't get anywhere. Thought I'd ask you guys if it's possible and, if so, how? :)
 
 
Thanks!
 
 
PS: Preferably this would work in 2.8 and 3.0.
 
 
---------- 2 of 2 ----------
From: Steve Barnes <gadge...@live.co.uk>
Date: Apr 15 05:25AM
Url: http://groups.google.com/group/wxpython-users/msg/242326697d9e3
 
Ryan,
 
The main missing trick is a queue, when your usual events happen trigger
an event that results in a handler that simply adds that event, or just
the important parts of it, to a queue. When your display update event
happens process the events in that queue. (Standard python queues should
work nicely for this).
 
You might also find it worth reading up a little on the "pubsub model"
where most of your events would publish their data and one, or more,
subscribers would deal with them.
--
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.
 
 
 
=============================================================================
Topic: Digest for wxpytho...@googlegroups.com - 7 updates in 3 topics
Url: http://groups.google.com/group/wxpython-users/t/5e844ef97601ca2d
=============================================================================
 
---------- 1 of 2 ----------
From: Digest recipients <sreht...@gmail.com>
Date: Apr 14 10:34AM -0700
Url: http://groups.google.com/group/wxpython-users/msg/21b6622d25e07
 
=============================================================================
Today's topic summary
=============================================================================
 
Group: wxpytho...@googlegroups.com
Url:
https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/wxpython-users/topics
 
 
- fully populating GridCellAttr()?? [2 Updates]
http://groups.google.com/group/wxpython-users/t/d24836c0e3d6e248
- Suspending accelerator processing inside wx.TextCtrl [1 Update]
http://groups.google.com/group/wxpython-users/t/b72940169807ba3a
- Could it be that TheClipboard object cannot be used with Threading on Linux? [4 Updates]
http://groups.google.com/group/wxpython-users/t/fd2d33101471239c
 
 
=============================================================================
Topic: fully populating GridCellAttr()??
Url: http://groups.google.com/group/wxpython-users/t/d24836c0e3d6e248
=============================================================================
 
---------- 1 of 2 ----------
From: braide...@gmail.com
Date: Apr 13 04:57AM -0700
Url: http://groups.google.com/group/wxpython-users/msg/1ba6d9057bf39
 
One really important difference between 2.8 and Phoenix deals with the
backend handling of GridCellAttr(). It appears that in 2.8, it is possible
just to simply create the object and then override specific properties. In
Phoenix, it appears that
 
my_attr=GridCellAttr()
 
creates an object with few or none of its attributes initialized.
 
Questions:
 
1. Is there some "best practice" way to fully populate the attributes?
2. Once these are created, should we do anything special during destruction?
 
Many Thanks, Eric
 
 
---------- 2 of 2 ----------
From: braide...@gmail.com
Date: Apr 14 06:47AM -0700
Url: http://groups.google.com/group/wxpython-users/msg/20f053e9718d0
 
Lesson - always remember to look at both wxPython and wxWidgets docs.
 
To POSSIBLY answer my own question 1:
 
gr=My wx.Grid Object
 
dch,dcv=gr.GetDefaultCellAlignment()
dcbgc=gr.GetDefaultCellBackgroundColour()
dcf=gr.GetDefaultCellFont()
dctc=gr.GetDefaultCellTextColour()
dce = gr.GetDefaultEditor()
dcr = gr.GetDefaultRenderer()
result = GridCellAttr() #new instance of GridCellAttr
#Go through steps to decide whether or not to use default or
override
#must make sure to set these props, default or otherwise
#renderer and editor require .IncRef(), according to my one
example???
 
The good news for me, fully populating attributes eliminates the errors
related to Null colors or Null Fonts or ...
 
The bad news, I am now getting an abrupt segfault, though this time it
complains about refcounts - oops, different thread
 
 
 
=============================================================================
Topic: Suspending accelerator processing inside wx.TextCtrl
Url: http://groups.google.com/group/wxpython-users/t/b72940169807ba3a
=============================================================================
 
---------- 1 of 1 ----------
From: James Scholes <ja...@jls-radio.com>
Date: Apr 14 01:21AM +0100
Url: http://groups.google.com/group/wxpython-users/msg/1e307729ae90f
 
Hi folks,
 
Just a quick question: I have an accelerator table set for my
application's main panel, and the shortcuts in it should be active
pretty much everywhere in the program. But they include some keystrokes
that are usually reserved for moving the cursor and selecting text
inside text fields (Ctrl+Left/Right for moving by word, Shift+Left/Right
for text selection).
 
How can I suspend processing of those accelerators while inside a
TextCtrl so that they carry out their normal functions? I tried setting
an accelerator table for the TextCtrl itself, and doing an event.Skip()
inside the wx.EVT_MENU handler. While this does prevent the keys from
triggering their panel-wide functions, they don't actually do what
they're supposed to do either. E.g. Ctrl+Left doesn't move by word, it
just leaves the cursor where it is.
 
Unsetting the accelerator table on focus seems like a bad idea, and
wouldn't work very well here as there are other shortcuts registered on
the table which should do something no matter the focused control type
 
Thanks in advance for any suggestions.
--
James Scholes
http://twitter.com/JamesScholes
 
 
 
=============================================================================
Topic: Could it be that TheClipboard object cannot be used with Threading on Linux?
Url: http://groups.google.com/group/wxpython-users/t/fd2d33101471239c
=============================================================================
 
---------- 1 of 4 ----------
From: Claudia Frank <cfran...@gmail.com>
Date: Apr 12 02:47PM -0700
Url: http://groups.google.com/group/wxpython-users/msg/18c0a14aafa7e
 
 
> Web search the '[xcb] ...' messages you saw and you'll soon find
> that this is a frequent problem, and not an issue with wxPython/GTK
> specifically.
 
I see, thank you for clarification.
 
Cheers
Claudia
 
 
---------- 2 of 4 ----------
From: Claudia Frank <cfran...@gmail.com>
Date: Apr 12 03:05PM -0700
Url: http://groups.google.com/group/wxpython-users/msg/18d0bb3ca4ad3
 
Hello James,
 
thank you to you as well.
I do see, that supporting multiple platforms comes with
... don't know how to say ... drawbacks (not exactly but I guess you know
what I mean.)
I wanted to avoid using ctypes because of the cross platform code.
Currently I'm running it only on my ubuntu machines but who knows maybe one
day
it will run on different os.
I guess I will try using IdleEvent.
 
Thank you very much
Claudia
 
 
---------- 3 of 4 ----------
From: Tim Roberts <ti...@probo.com>
Date: Apr 12 10:41PM -0700
Url: http://groups.google.com/group/wxpython-users/msg/1a5efe182dcf3
 
>> used in such a case?
 
> Yes - consider the whole library to not have thread safety and
> coordinate access to it appropriately.
 
This note deserves comment, because it misplaces the blame. This is not a WX problem. The issue is the underlying operating systems. On Windows, you can do quite a lot of GUI stuff from other threads. On MacOS, you can do GUI stuff on bitmaps, as long as you protect it with locks. On Linux, NOTHING works from a secondary thread.

Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.
 
 
---------- 4 of 4 ----------
From: James Scholes <ja...@jls-radio.com>
Date: Apr 13 10:31AM +0100
Url: http://groups.google.com/group/wxpython-users/msg/1b27882ad15bd
 
Tim Roberts wrote:
> This note deserves comment, because it misplaces the blame. This is not a WX problem. The issue is the underlying operating systems.
 
I did point this out later in the same email,
braide...@gmail.com: Apr 15 10:14AM -0700

After more time than I wish to think about, I have managed to have
traits/traitsui/pyface demos working without segfaults under Python 3.6 and
wxPython Phoenix, and have most deprecated behaviors updated.
 
In summary, the triggers for two primary segfaulting issues:
 
1. PushEventHandler - my "cure" was to comment this line out wherever it
occurred.
2. GetAttr method under a custom GridTableBase object - "cure" was to
simply let the default method for the class handle the calls.
 
At this point, there may be unintended consequences of the "cures" like
memory leaks or performance hits or some missed event responses. Clearly
more detailed testing needs to be done to monitor for non-catastrophic
fails, but I am ecstatic to be able to move forward on other things.
 
I have not tested every nook and cranny of mayavi, but everything I've
tested seems to be working properly. Most important since my last report is
that shifting from "Basic" to "Advanced" views doesn't crash the program.
That said, it appears the "Advanced" view is a blank screen - maybe a hint
that if you want a more advanced interface you probably should program the
behaviors directly in your scripts.
 
Cheers, Eric
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to wxpython-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages