Thanks for the tip on making sample applications. It turns out that it did help with diagnosis, but I still can't find a solution. It would appear that there's something about the images that I am putting in that makes the fit not work, since as soon as I took it out everything worked great. I have attached a sample application that replicates the problem as well as the two images that it uses.
For reference, the project is an elevator simulation. Yes, it is for class, but the class is concerned with the development of the control logic, not the GUI. Thanks very much!
Andrew Bouchard
<elevator_closed.jpg><elevator_open.jpg># Elevator Simulator
# Written by Andrew Bouchard
# This program simulates the behavior of a simple elevator and was written for the Vanderbilt University fall 2008 class
# CS376 Hybrid and Embedded Systems taught by Xenofon Koutsoukos
# Date Started: 8/31/2008
# Last Updated: 9/1/2008
# Import needed libraries
import wx
print wx.version()
# This is the main GUI class
class Elevator(wx.Frame):
def __init__(self, parent, id, title):
# Initialize the frame
wx.Frame.__init__(self, parent, id, title, size=(500, 800))
# Declare fonts
title = wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.BOLD)
subtitle = wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD)
# Define the panel and the sizer
panel = wx.Panel(self, -1)
sizer = wx.GridBagSizer(0, 0)
# Create elevator images
OpenImage = 'elevator_open.jpg'
open = wx.Image(OpenImage, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
ClosedImage = 'elevator_closed.jpg'
closed = wx.Image(ClosedImage, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
# Declare the row for the gui widgets
guirow = 0
# Column Labels
lblIncallsTitle = wx.StaticText(panel, -1, 'Internal calls')
sizer.Add(lblIncallsTitle, (guirow, 0), flag=wx.ALL | wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL, border=5)
lblExcallsTitle = wx.StaticText(panel, -1, 'External calls')
sizer.Add(lblExcallsTitle, (guirow, 2), (1, 2), wx.ALL | wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL, 5)
guirow = guirow+1
# Second floor
# Incall button
self.cmdIncall2 = wx.ToggleButton(panel, 2, '2')
sizer.Add(self.cmdIncall2, (guirow, 0), (1,1), flag=wx.ALL | wx.ALIGN_CENTER, border=5)
# Elevator graphic
self.floor2 = wx.StaticBitmap(self, -1, closed)
sizer.Add(self.floor2, (guirow, 1), (1,1), flag=wx.ALL | wx.ALIGN_CENTER, border=5)
# Excall up button
self.cmdExcall2Up = wx.ToggleButton(panel, 12, 'Up')
sizer.Add(self.cmdExcall2Up, (guirow, 2), (1,1), flag=wx.ALL > wx.ALIGN_CENTER, border=5)
# Excall down button
self.cmdExcall2Down = wx.ToggleButton(panel, 22, 'Down')
sizer.Add(self.cmdExcall2Down, (guirow, 3), (1,1), flag=wx.ALL | wx.ALIGN_CENTER, border=5)
guirow = guirow+1
# First floor
# Incall button
self.cmdIncall1 = wx.ToggleButton(panel, 1, '1')
sizer.Add(self.cmdIncall1, (guirow, 0), (1,1), flag=wx.ALL | wx.ALIGN_CENTER, border=5)
# Elevator graphic
self.floor1 = wx.StaticBitmap(self, -1, open)
sizer.Add(self.floor1, (guirow, 1), (1,1), flag=wx.ALL | wx.ALIGN_CENTER, border=5)
# Excall up button
self.cmdExcall1Up = wx.ToggleButton(panel, 11, 'Up')
sizer.Add(self.cmdExcall1Up, (guirow, 2), (1,1), flag=wx.ALL > wx.ALIGN_CENTER, border=5)
# Excall down button
self.cmdExcall1Down = wx.ToggleButton(panel, 21, 'Down')
sizer.Add(self.cmdExcall1Down, (guirow, 3), (1,1), flag=wx.ALL | wx.ALIGN_CENTER, border=5)
guirow = guirow+1
# Step button
cmdStep = wx.Button(panel, -1, 'Step')
sizer.Add(cmdStep, (guirow, 0), (1,2), flag=wx.ALL | wx.ALIGN_CENTER | wx.EXPAND, border=5)
# Reset button
cmdReset = wx.Button(panel, -1, 'Reset')
sizer.Add(cmdReset, (guirow, 2), (1,2), flag=wx.ALL | wx.ALIGN_CENTER | wx.EXPAND, border=5)
sizer.AddGrowableCol(0)
sizer.AddGrowableRow(guirow)
panel.SetSizerAndFit(sizer)
self.Centre()
self.Show(True)
# Start the GUI
app = wx.App()
main = Elevator(None, -1, 'Elevator Simulation')
app.MainLoop()_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users