Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Cannot enter text into wx.TextCtrl in newly created Frame

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
hiephm
Posts: 2
Joined: Sat Jul 24, 2010 6:48 pm

Cannot enter text into wx.TextCtrl in newly created Frame

Post 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.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

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

Post by Pako »

Code: Select all

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

    def __call__(self):
        frame = wx.CallAfter(MyFrame, None, 'Small editor') 
Pako
hiephm
Posts: 2
Joined: Sat Jul 24, 2010 6:48 pm

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

Post by hiephm »

Thanks Pako

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

It works alright now, thanks again.

HiepHM.
Post Reply