Need help with TextCtrl for wxPython

Hi All,

[   1](http://wiki.wxpython.org/Getting%20Started#CA-2027449e237ae284917eee75525d7d18cb8e46ad_1) #!/usr/bin/env python
[   2](http://wiki.wxpython.org/Getting%20Started#CA-2027449e237ae284917eee75525d7d18cb8e46ad_2) import wx
[   3](http://wiki.wxpython.org/Getting%20Started#CA-2027449e237ae284917eee75525d7d18cb8e46ad_3) class MyFrame(wx.Frame):
[   4](http://wiki.wxpython.org/Getting%20Started#CA-2027449e237ae284917eee75525d7d18cb8e46ad_4)     """ We simply derive a new class of Frame. """
[   5](http://wiki.wxpython.org/Getting%20Started#CA-2027449e237ae284917eee75525d7d18cb8e46ad_5)     def __init__(self, parent, title):
[   6](http://wiki.wxpython.org/Getting%20Started#CA-2027449e237ae284917eee75525d7d18cb8e46ad_6)         wx.Frame.__init__(self, parent, title=title, size=(200,100))
[   7](http://wiki.wxpython.org/Getting%20Started#CA-2027449e237ae284917eee75525d7d18cb8e46ad_7)         self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
[   8](http://wiki.wxpython.org/Getting%20Started#CA-2027449e237ae284917eee75525d7d18cb8e46ad_8)         self.Show(True)
[   9](http://wiki.wxpython.org/Getting%20Started#CA-2027449e237ae284917eee75525d7d18cb8e46ad_9)
[  10](http://wiki.wxpython.org/Getting%20Started#CA-2027449e237ae284917eee75525d7d18cb8e46ad_10) app = wx.App(False)
[  11](http://wiki.wxpython.org/Getting%20Started#CA-2027449e237ae284917eee75525d7d18cb8e46ad_11) frame = MyFrame(None, 'Small editor')
[  12](http://wiki.wxpython.org/Getting%20Started#CA-2027449e237ae284917eee75525d7d18cb8e46ad_12) app.MainLoop()

I have picked the below example code for implementing a text editor

···

################################################################
################################################################

My query here is how can I implement the above code without using class(). Is it possible?

In general, my output should look like this:

1)Frame having title text as “Text Editor”

2)The area below the title bar will be a TextCtrl area which allows user to input text

Thanks.

Regards,

RD

Yes, of course it is. Every class structure can be unrolled. But
why? What on earth is the point? The class here serves to separate
and encapsulate individual responsibility. It’s just better coding
practice.

···

Reuben Decruz wrote:

        I have picked the below example code for implementing a

text editor

        ...
        My query here is how can I implement the above code

without using class(). Is it possible?

import wx

  app = wx.App(False)

  frame = wx.Frame(None, title='Small editor', size=(200,100))

  wx.TextCtrl(frame, style=wx.TE_MULTILINE)

  frame.Show(True)

  app.MainLoop()
-- Tim Roberts, Providenza & Boekelheide, Inc.

timr@probo.com