473,563 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

wxPython: GridBagSizer, EXPAND, and HtmlListBox

I'm having some trouble using an HtmlListBox with a GridBagSizer. I'm
not sure how best to explain what's happening, but it seems that every
time my frame gets resized, the HtmlListBox grows taller, even when the
resize is only horizontal, or makes the frame smaller. I'm pretty new
to GUI layout and wxPython, so hopefully I'm doing something obviously
wrong. Here's a short runnable code sample showing my basic layout (I'm
using python 2.3.3 and wxPython 2.6 running on windows XP pro):

-----Start Code-----

import wx

class TestFrame(wx.Fr ame):
def __init__(self):
app = wx.PySimpleApp( )
wx.Frame.__init __(self, None, -1)
p = wx.Panel(self, -1)
gbs = wx.GridBagSizer (5, 5)
gbs.Add(wx.Butt on(p, -1), (0, 0), span=(1, 2), flag=wx.EXPAND)
hlb = wx.HtmlListBox( p, -1)
gbs.Add(hlb, (1, 0), span=(4, 1), flag=wx.EXPAND)
gbs.Add(wx.Butt on(p, -1), (1, 1), flag=wx.EXPAND)
gbs.Add(wx.Butt on(p, -1), (2, 1), flag=wx.EXPAND)
gbs.Add(wx.Butt on(p, -1), (3, 1), flag=wx.EXPAND)
gbs.Add(wx.Butt on(p, -1), (4, 1), flag=wx.EXPAND)
gbs.AddGrowable Row(2)
gbs.AddGrowable Col(1)
p.SetSizerAndFi t(gbs)
self.SetClientS ize(p.GetSize() )
self.Show(True)
wx.EVT_SIZE(hlb , self.onSize)
app.MainLoop()

def onSize(self, event):
print event.GetSize()

if __name__ == '__main__':
TestFrame()

-----End Code-----

If you run that and try to resize the window by dragging an edge, the
HtmlListBox just goes crazy and keeps getting bigger (try dragging the
right edge back and forth).

It does the same thing if I replace the HtmlListBox with a wx.Panel or
even a wx.Window, but not with a wx.ListBox, or wx.Button. The effect
I'm trying to accomplish is basically what you get if you sub in a
wx.ListBox, (but I need the HtmlListBox because I want to put a small
image next to the strings in the list).

Removing the wx.EXPAND flag on the HtmlListBox (at line 11) solves the
weird resizing, except that now the HtmlListBox doesn't fill the space
it needs to.

Does anyone know what's going on here, or how I can get this to work?

Jul 19 '05 #1
1 3482
Just an update if anyone runs across this through google. It appears
this was an issue fixed in 2.6.0.1 (or 2.6.1.0, I forget which
exactly). I was using 2.6.0.0.

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1366
by: plumpy321 | last post by:
Hi, I took an example from wxPython with the IE web browser and created a refresh button to automatically refresh a web page in 5 second intervals. But I notice that the memory utilization in Python keeps increasing over time. Can anyone tell me why this is happening? Here is my code: ...
1
2390
by: ncf | last post by:
Recently, I came across a presentation about wx.GridBagSizer while trying to look up more info to use it in an application, however, the presentation noted "Don't use GridBagSizer. Ever." Can anyone please explain to me why using GridBagSizer would be such a bad idea? Or is this only applicable when using XRC? Presentation URI:...
1
2788
by: PeterG | last post by:
Hi, I am relatively new to Python, and am learning it as part of a university module... Im currently undertaking a project to create an IM server and IM gui client. I have a very basic server, and a basic gui client. I can get my
0
1071
by: KvS | last post by:
Hi all, a question wrt renewing the entries in a wx.HtmlListBox, I don't understand how to do it. I have some global variable containing a list: gl_NAWList= then I create a subclass of wx.HtmlListBox as described in the wxPython
2
1291
by: Chris Brat | last post by:
Hi, What sizers do people use to - contain the notebook control in a Frame and, - contain the contents of a single page of the notebook. At the moment Im using a GridBagSizer for both but this seems to be overkill. Is a BoxSizer a better option?
9
4407
by: Tyler | last post by:
Hello All: I am currently working on a project to create an FEM model for school. I was thinking about using wxPython to gather the 12 input variables from the user, then, after pressing the "Run" button, the GUI would close, and the 12 input variables would then be available for the rest of the program. So far, what I have been able to...
1
4566
by: aeroumr | last post by:
In the following code, I have created a panel with a button and a textctrl object on it. I have also created a menubar that will create a new text file (i.e. textctrl object). My problem is that when I create a new file, it displays the textctrl over the top left of my existing panel. I know that the reason is because I have specified the...
2
1315
by: SMALLp | last post by:
Hy. I need help. I'm using BoxSizer and i put TextCtrl and StaticText next to each other and they gor alligned by top of TextCtrl and it looks terrible. How can i make thm to be alligned by center of each controll. Thnaks!
0
1090
by: Robin Dunn | last post by:
Announcing ---------- The 2.8.8.1 release of wxPython is now available for download at http://wxpython.org/download.php. This is a minor bugfix release with several fixes for problems discovered in the 2.8.8.0 release. Source code is available, as well as binaries for Python 2.3, 2.4 and 2.5, for Windows and Mac, as well some packages...
0
7580
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7882
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7634
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7945
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.