Page 1 of 1

Cannot enter text into wx.TextCtrl in newly created Frame

Posted: Sat Jul 24, 2010 7:16 pm
by hiephm
Hi all,

I have an idea to create a new Frame right in plugin's Action.
(because I think it will be easier to interact between eg and this frame than completely independent app). Like this snippet:

Code: Select all

import eg

eg.RegisterPlugin()

# Create new Frame, containing a text box.
class MyFrame(wx.Frame):
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, title=title, size=(200,100))
        self.control = wx.TextCtrl(self,-1)
        self.Show(True)

class HelloWorldPlugin(eg.PluginBase):
    def __init__(self):
        self.AddAction(HelloWorld)

class HelloWorld(eg.ActionBase):
    name = "Hello World"

    def __call__(self):
        frame = MyFrame(None, 'Small editor') 
The problems is, I cannot enter text to above text box by keyboard. I can use right mouse button to cut/paste, however.

Are there anyone have the same problem?

Any suggestion will be appreciated.

Best regards.
HiepHM.

Re: Cannot enter text into wx.TextCtrl in newly created Frame

Posted: Sun Jul 25, 2010 5:26 pm
by Pako

Code: Select all

class HelloWorld(eg.ActionBase):
    name = "Hello World"

    def __call__(self):
        frame = wx.CallAfter(MyFrame, None, 'Small editor') 
Pako

Re: Cannot enter text into wx.TextCtrl in newly created Frame

Posted: Mon Jul 26, 2010 3:53 pm
by hiephm
Thanks Pako

After refered to CallAfter in wiki, I understood the reason.

It works alright now, thanks again.

HiepHM.