Eliminating scroll bar from multi-line text control

I'm trying to write a code editor that's easy to use w/ voice recognition. At the top of the screen I've got a command line. Below it, I have three multi-line text controls: one to store line numbers, so I can show the correct line number next to each line; one for the code; and one for a log. I'm using sizers to place them. The problem I've encountered is that while the code text control doesn't have a scroll bar, the one for line numbers does, and I don't know why. In the documentation, I couldn't see any flag to set to tell wxPython not to add a scroll bar. Any suggestions?

Here's snippets of the code:

···

---------------------
# Set up the line numbers
self.lineNumbers = wxTextCtrl(self, -1, size=(40, 500),
    style = wxTE_MULTILINE|wxTE_READONLY|wxTE_DONTWRAP)
self.lineNumbers.SetFont(basicFont)
a = []
for i in range(0,1000):
  a.append(str(i))
self.lineNumbers.SetValue(join(a, "\n"))

# Set up the code window
self.codeWindow = wxTextCtrl(self, -1, size=(550, 500),
    style = wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH2)
self.codeWindow.SetFont(basicFont)
    
# Set up the log
self.log = wxTextCtrl(self, -1, size=(220, 500),
      style = wxTE_MULTILINE|wxTE_READONLY)
self.log.SetFont(basicFont)

-----------------------

Incidentally, if there's a cleaner way to handle the line numbers, I'd love to hear it; it's a bit of kludge.

Thanks,
Anders Schneiderman
SEIU International

Anders Schneiderman wrote:

I'm trying to write a code editor that's easy to use w/ voice
recognition. At the top of the screen I've got a command line.
Below it, I have three multi-line text controls: one to store line
numbers, so I can show the correct line number next to each line; one
for the code; and one for a log. I'm using sizers to place them.
The problem I've encountered is that while the code text control
doesn't have a scroll bar, the one for line numbers does, and I don't
know why. In the documentation, I couldn't see any flag to set to
tell wxPython not to add a scroll bar. Any suggestions?

The wxTE_RICH2 style causes a different native control to be used so you are probably seeing different native defaults. Try using the same style on all the text controls to get consistent behaviour.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!