Re: Digest for wxpython-users@googlegroups.com - 7 updates in 4 topics

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Digest for wxpython-users@googlegroups.com - 7 updates in 4 topics

bobsrq
Your email dated 15-Apr-2017 04:27 PM with Subject= "[wxPython-users] Digest for [hidden email] - 7
 updates in 4 topics" had a bad keyword (No keywords found; must have one of ['Member', 'Employee', 'Vendor']) in the Subject so cannot be processed by the Club MasterList system at the CCoSHA gatehouse, if that was your intent.

[This message was generated automatically by software.  Do not reply to this message.]

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

franz steinhaeusler <[hidden email]>: Apr 15 09:20AM -0700

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
>>> r = l.GetItemText(0)
>>> print r, len(r)
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
511
 
in Gtk;
>>> l=wx.ListCtrl(c)
>>> l.InsertStringItem(0, "h"*700)
0
>>> r = l.GetItemText(0)
>>> print r, len(r)
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
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!
franz steinhaeusler <[hidden email]>: Apr 15 09:23AM -0700

Forgot to mention: Python 2.7, wxPython 2.8.12.1 (same on windows and on
ubuntu)
Steve Barnes <[hidden email]>: Apr 15 05:29AM

> 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.
Ryan Holmes <[hidden email]>: Apr 14 09:13PM -0700

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.
Steve Barnes <[hidden email]>: Apr 15 05:25AM

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.
Digest recipients <[hidden email]>: Apr 14 10:34AM -0700

=============================================================================
Today's topic summary
=============================================================================
 
Group: [hidden email]
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: [hidden email]
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: [hidden email]
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 <[hidden email]>
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 <[hidden email]>
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 <[hidden email]>
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 <[hidden email]>
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, [hidden email]
Providenza & Boekelheide, Inc.
 
 
---------- 4 of 4 ----------
From: James Scholes <[hidden email]>
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, as well as quoting the
official wxWidgets docs which say the same thing. But as wx is designed
to be a cross-platform library, the end-result is often the same - wx
cannot be considered to be thread-safe.
--
James Scholes
http://twitter.com/JamesScholes
 
 
 
 
 
 
--
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page:
https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/wxpython-users/join
.
To unsubscribe from this group and stop receiving emails from it send an email to [hidden email].
Digest recipients <[hidden email]>: Apr 14 10:34AM -0700

=============================================================================
Today's topic summary
=============================================================================
 
Group: [hidden email]
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: [hidden email]
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: [hidden email]
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 <[hidden email]>
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 <[hidden email]>
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 <[hidden email]>
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 <[hidden email]>
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, [hidden email]
Providenza & Boekelheide, Inc.
 
 
---------- 4 of 4 ----------
From: James Scholes <[hidden email]>
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, as well as quoting the
official wxWidgets docs which say the same thing. But as wx is designed
to be a cross-platform library, the end-result is often the same - wx
cannot be considered to be thread-safe.
--
James Scholes
http://twitter.com/JamesScholes
 
 
 
 
 
 
--
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page:
https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/wxpython-users/join
.
To unsubscribe from this group and stop receiving emails from it send an email to [hidden email].
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 [hidden email].