Hi,
In Feb 2011, I posted this issue I'm having with upgrading from Python 2.4.3
to ActivePython 2.7.1.3. The workaround that I discovered turned out not to
be a workaround, it just masked to underlying problem that I am having.
Since then, I have done some more experimentation and now I have additional
clues.
With 2.7, when I start this application from the unix command line, it
works fine.
python TextCtrlApp.py
When I start this application from the python console command line, I get
the undesired behavior that I describe in the original post.
execfile("TextCtrlApp.py")
I don't have this problem with Python 2.4.
My entire environment for using python is centered around launching GUIs
from ipython, so using the method of launching GUIs from the unix prompt is
not a solution.
Is there another way to launch the application from within the python
console that would resolve this issue?
···
---------------------------------
Here is the code for TextCtrlApp.py:
import wx
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "My Frame", size=(300, 300))
panel = wx.Panel(self, -1)
panel.Bind(wx.EVT_MOTION, self.OnMove)
wx.StaticText(panel, -1, "Pos:", pos=(10, 12))
self.posCtrl = wx.TextCtrl(panel, -1, "", pos=(40, 10))
def OnMove(self, event):
pos = event.GetPosition()
self.posCtrl.SetValue("%s, %s" % (pos.x, pos.y))
app = wx.PySimpleApp()
frame = MyFrame()
frame.Show(True)
app.MainLoop()
------------------------------
Here is the content of the original post:
I recently upgraded my Linux python environment from Python 2.4.3 (#3, Aug 1
2006, 10:29:54) to ActivePython 2.7.1.3. My python applications that have
been stable for many years seem to be working OK except for one major
annoyance.
When I have text selected in a different application(Konsole for example)
the TextCtrl in my python application removes the selection when the
TextCtrl is updated with a new value(SetValue).
I have reproduced the problem with the example in the following tutorial, so
I am confident that the problem is not with my python application code.
When I pass the mouse over this application, the selection in other
non-python applications goes away.
Is this normal behavior for this release?
Basically, I cannot edit, copy or past in other applications while my python
applications are running because of this.
I am using K Desktop Environment. Release 3.3.1-11.el4 Red Hat with UNIX
system behavior.
--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/TextCtrl-steals-selection-from-other-applications-in-linux-window-manager-tp3378745p4921577.html
Sent from the wxPython-users mailing list archive at Nabble.com.