TextCtrl in GridBagSizer grows beyond frame border

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
poro
In need of some credit
In need of some credit
Posts: 1
Joined: Mon Feb 28, 2005 2:34 pm

TextCtrl in GridBagSizer grows beyond frame border

Post by poro » Mon Feb 28, 2005 2:46 pm

simple created a frame, put a panel on it, inside a textctrl using a GridBagSizer to layout the panel.

the problem is, the textctrl grows beyond the frame border :(
resizing the window doesn't resize the textCtrl

import wx

class MyFrame(wx.Frame):

def __init__(
self, parent, ID, title, pos=wx.DefaultPosition,
size=(300,700), style=wx.DEFAULT_FRAME_STYLE
):
wx.Frame.__init__(self, parent, ID, title, pos, size, style)
self.framePanel = wx.Panel(self, -1 )

frameSizer = wx.GridBagSizer(1,1)
frameSizer.AddGrowableRow(0)
frameSizer.AddGrowableCol(0)
self.tcLog = wx.TextCtrl(self.framePanel, -1, style=wx.TE_MULTILINE|wx.TE_RICH2|wx.HSCROLL|wx.TE_READONLY )
self.tcLog.FitInside()
frameSizer.Add( self.tcLog , (0,0) , flag= wx.EXPAND )
self.framePanel.SetSizerAndFit( frameSizer )

for i in range(70):
self.tcLog.AppendText("a\n")

class MyApp(wx.App):

def OnInit(self):
win = MyFrame(None, -1, "bug", size=(600, 600), style = wx.DEFAULT_FRAME_STYLE)
win.Show(True)
return True

if __name__ == '__main__':
app = MyApp(0)
app.MainLoop()

i'm using
python 2.3.4 and wxWidgets 2.5.3

the code is based on the wxPython Demo

Post Reply