Fixing some part of text in wx.textctrl

I am trying to create a command terminal like window…I have used the following code…Problem is that it set the command prompt as “>>>” that is editable.

I want window with fixed “>>>” with cursor waiting for command…now the issue is that user can easily delete “>>>” as it is a simple text…

Is it any way to fixed this part of text in wx.textctrl or in any other control.

class MyFrame(wx.Frame):

def init(self, parent, title):

wx.Frame.init(self, parent, title=title, size=(400,400))

self.SetPosition(wx.Point(0,0))

self.cmdArea = wx.TextCtrl(self, style=wx.TE_MULTILINE)

self.cmdArea.SetValue(">>>")

self.Show(True)

I am trying to create a command terminal like window..I have used the
following code..Problem is that it set the command prompt as ">>>" that is
editable.

I want window with fixed ">>>" with cursor waiting for command...now the
issue is that user can easily delete ">>>" as it is a simple text..

Is it any way to fixed this part of text in wx.textctrl or in any other
control.

class MyFrame(wx.Frame):

    def __init__(self, parent, title):
           wx.Frame.__init__(self, parent, title=title, size=(400,400))
           self.SetPosition(wx.Point(0,0))
           self.cmdArea = wx.TextCtrl(self, style=wx.TE_MULTILINE)

           self.cmdArea.SetValue(">>>")
           self.Show(True)

I don't think you can do this with wx.TextCtrl. But you can, maybe sort
of, with StyledTextCtrl. Notice this (from here
http://www.yellowbrain.com/stc/styling.html):

*StyleSetChangeable(style, changeable)*

This is an experimental and incompletely implemented style attribute. The
default setting is changeable set true but when set false it makes text
read-only. Currently it only stops the caret from being within
not-changeable text and does not yet stop deleting a range that contains
not-changeable text.

The values *style* and *changeable* are integers. The return value is None.

I noticed the shell on the wxPython IDE I use is probably using this, since
I can't move the caret into the >>> area, but I can highlight everything
around it and delete it. That said, I've used IDE for many years and never
once thought to do that, so perhaps it is good enough?

It may also be updated by now, I haven't looked carefully at all.

Che

···

On Mon, Aug 4, 2014 at 3:21 PM, Hemadri Saxena <hemadri.saxena@gmail.com> wrote:

--
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 wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hemadri Saxena wrote:

I am trying to create a command terminal like window..I have used the
following code..Problem is that it set the command prompt as ">>>"
that is editable.

I want window with fixed ">>>" with cursor waiting for command...now
the issue is that user can easily delete ">>>" as it is a simple text..

How do you expect this to work? How are you going to know where they
entered their command? In a simple TextCtrl, every line is editable.
What if they cursor up and enter a command somewhere higher? Will you
handle that? How will you know where they typed?

Put simply, a TextCtrl is probably not the right choice for this.
wxPython includes the PyCrust and PyShell modules, which allow you to
embed a Python interpreter window in your wxPython application. They do
the kind of custom window message handling that you need to be a generic
Python shell.
    http://www.wxpython.org/py.php

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Hi Tim,

Thanks for the alternative…Is there any working example which I can look into ? It will be a great help

Thanks and Regards

Hemadri

···

On Tue, Aug 5, 2014 at 12:44 PM, Tim Roberts timr@probo.com wrote:

Hemadri Saxena wrote:

I am trying to create a command terminal like window…I have used the

following code…Problem is that it set the command prompt as “>>>”

that is editable.

I want window with fixed “>>>” with cursor waiting for command…now

the issue is that user can easily delete “>>>” as it is a simple text…

How do you expect this to work? How are you going to know where they

entered their command? In a simple TextCtrl, every line is editable.

What if they cursor up and enter a command somewhere higher? Will you

handle that? How will you know where they typed?

Put simply, a TextCtrl is probably not the right choice for this.

wxPython includes the PyCrust and PyShell modules, which allow you to

embed a Python interpreter window in your wxPython application. They do

the kind of custom window message handling that you need to be a generic

Python shell.

[http://www.wxpython.org/py.php](http://www.wxpython.org/py.php)

Tim Roberts, timr@probo.com

Providenza & Boekelheide, Inc.

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 wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


Thanks and Regards
Hemadri Saxena
9086087510

Hi Tim,

I have installed the package and tried the “PyCrust”. Can I customize it ?

Problem is that I want something which I can control…I don’t want to give user that much control and information.

My requirement is as follows :

  1. I want to launch a window (may be PyCrust) with few user defined modules already imported and ready to use.

  2. user can enter python command but command output should not goto the same console . I want to capture the output and process that output then show it in different window.

  3. I do not want that extra windows like Namespace,Dispatch etc and I don’t want Menu bar as well

Thanks and Regards

Hemadri

···

On Tue, Aug 5, 2014 at 1:16 PM, Hemadri Saxena hemadri.saxena@gmail.com wrote:

Hi Tim,

Thanks for the alternative…Is there any working example which I can look into ? It will be a great help

Thanks and Regards

Hemadri


Thanks and Regards
Hemadri Saxena
9086087510

On Tue, Aug 5, 2014 at 12:44 PM, Tim Roberts timr@probo.com wrote:

Hemadri Saxena wrote:

I am trying to create a command terminal like window…I have used the

following code…Problem is that it set the command prompt as “>>>”

that is editable.

I want window with fixed “>>>” with cursor waiting for command…now

the issue is that user can easily delete “>>>” as it is a simple text…

How do you expect this to work? How are you going to know where they

entered their command? In a simple TextCtrl, every line is editable.

What if they cursor up and enter a command somewhere higher? Will you

handle that? How will you know where they typed?

Put simply, a TextCtrl is probably not the right choice for this.

wxPython includes the PyCrust and PyShell modules, which allow you to

embed a Python interpreter window in your wxPython application. They do

the kind of custom window message handling that you need to be a generic

Python shell.

[http://www.wxpython.org/py.php](http://www.wxpython.org/py.php)

Tim Roberts, timr@probo.com

Providenza & Boekelheide, Inc.

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 wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


Thanks and Regards
Hemadri Saxena
9086087510

Tim, I posted code showing how to do this in the duplicate thread for this topic. Basically after a user presses enter and the code is executed, you would print out the stdout/stderr, then a newline and >>>… since you print >>> you know where to disallow editing (before that point, as I posted in the code snippet)

···

On Tuesday, August 5, 2014 9:45:04 AM UTC-7, Tim Roberts wrote:

Hemadri Saxena wrote:

I am trying to create a command terminal like window…I have used the

following code…Problem is that it set the command prompt as “>>>”

that is editable.

I want window with fixed “>>>” with cursor waiting for command…now

the issue is that user can easily delete “>>>” as it is a simple text…

How do you expect this to work? How are you going to know where they

entered their command? In a simple TextCtrl, every line is editable.
What if they cursor up and enter a command somewhere higher? Will you

handle that? How will you know where they typed?

Put simply, a TextCtrl is probably not the right choice for this.
wxPython includes the PyCrust and PyShell modules, which allow you to

embed a Python interpreter window in your wxPython application. They do

the kind of custom window message handling that you need to be a generic

Python shell.

[http://www.wxpython.org/py.php](http://www.wxpython.org/py.php)


Tim Roberts, ti...@probo.com

Providenza & Boekelheide, Inc.

which post ???

···

On Tue, Aug 5, 2014 at 3:33 PM, Nathan McCorkle nmz787@gmail.com wrote:

Tim, I posted code showing how to do this in the duplicate thread for this topic. Basically after a user presses enter and the code is executed, you would print out the stdout/stderr, then a newline and >>>… since you print >>> you know where to disallow editing (before that point, as I posted in the code snippet)

On Tuesday, August 5, 2014 9:45:04 AM UTC-7, Tim Roberts wrote:

Hemadri Saxena wrote:

I am trying to create a command terminal like window…I have used the

following code…Problem is that it set the command prompt as “>>>”

that is editable.

I want window with fixed “>>>” with cursor waiting for command…now

the issue is that user can easily delete “>>>” as it is a simple text…

How do you expect this to work? How are you going to know where they

entered their command? In a simple TextCtrl, every line is editable.
What if they cursor up and enter a command somewhere higher? Will you

handle that? How will you know where they typed?

Put simply, a TextCtrl is probably not the right choice for this.
wxPython includes the PyCrust and PyShell modules, which allow you to

embed a Python interpreter window in your wxPython application. They do

the kind of custom window message handling that you need to be a generic

Python shell.

[http://www.wxpython.org/py.php](http://www.wxpython.org/py.php)

Tim Roberts, ti...@probo.com

Providenza & Boekelheide, Inc.

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 wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


Thanks and Regards
Hemadri Saxena
9086087510

https://groups.google.com/d/msg/wxpython-users/KQv0HgKqSuo/SzOU7yXLUMAJ

···

On Tuesday, August 5, 2014 12:39:45 PM UTC-7, Hemadri Saxena wrote:

which post ???

On Tue, Aug 5, 2014 at 3:33 PM, Nathan McCorkle nmz...@gmail.com wrote:

Tim, I posted code showing how to do this in the duplicate thread for this topic. Basically after a user presses enter and the code is executed, you would print out the stdout/stderr, then a newline and >>>… since you print >>> you know where to disallow editing (before that point, as I posted in the code snippet)

On Tuesday, August 5, 2014 9:45:04 AM UTC-7, Tim Roberts wrote:

Hemadri Saxena wrote:

I am trying to create a command terminal like window…I have used the

following code…Problem is that it set the command prompt as “>>>”

that is editable.

I want window with fixed “>>>” with cursor waiting for command…now

the issue is that user can easily delete “>>>” as it is a simple text…

How do you expect this to work? How are you going to know where they

entered their command? In a simple TextCtrl, every line is editable.
What if they cursor up and enter a command somewhere higher? Will you

handle that? How will you know where they typed?

Put simply, a TextCtrl is probably not the right choice for this.
wxPython includes the PyCrust and PyShell modules, which allow you to

embed a Python interpreter window in your wxPython application. They do

the kind of custom window message handling that you need to be a generic

Python shell.

[http://www.wxpython.org/py.php](http://www.wxpython.org/py.php)

Tim Roberts, ti...@probo.com

Providenza & Boekelheide, Inc.

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 wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


Thanks and Regards
Hemadri Saxena
9086087510

Hemadri Saxena wrote:

I have installed the package and tried the "PyCrust". Can I customize it ?

Problem is that I want something which I can control..I don't want to
give user that much control and information.

My requirement is as follows :

1. I want to launch a window (may be PyCrust) with few user defined
modules already imported and ready to use.
2. user can enter python command but command output should not goto
the same console . I want to capture the output and process that
output then show it in different window.
3. I do not want that extra windows like Namespace,Dispatch etc and I
don't want Menu bar as well

Please do read Nathan's advice, because that might be more suited to
your thinking.

It seems to me that the easiest way would be to have two separate
windows: a short TextCtrl window where the user enters his code, and a
larger read-only window where you display the results.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.