Hello, All:
I am an old C programmer just learning Python and wxpython. This is my first attempt at a real Python GUI application. My intent is to display a jpeg file of a logo which changes depending on a registry setting, which the user may then change. The code snippet below replaces all the registry stuff with the global variable "TestName". The initial call works, displaying the first logo correctly. When I change the setting (such as by calling OnMenuRainbow), I can see the replacement jpeg flash onscreen for a moment at too large a size, but then the original logo returns. I feel that I may be using wx.StaticBitmap incorrectly, but cannot find documents on what it really does. My error is probably in the DisplayImage routine, below. Can anyone help with this?
···
____________
Vernon
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
import wx
TestName = 'YOUNG'
class MainFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1,"SwitchODBC",
wx.DefaultPosition, wx.Size(250, 100))
self.ReadODBCinfo()
menu = self.MakeMenu()
self.SetMenuBar(menu)
wx.EVT_MENU(self, 1001, self.OnMenuExit)
wx.EVT_MENU(self, 1002, self.OnMenuAbout)
wx.EVT_MENU(self, 1101, self.OnMenuMontego)
wx.EVT_MENU(self, 1102, self.OnMenuPeppermill)
wx.EVT_MENU(self, 1103, self.OnMenuRainbow)
def DisplayImage(self,name):
image = wx.Image(name, wx.BITMAP_TYPE_JPEG)
temp = image.ConvertToBitmap()
self.bmp = wx.StaticBitmap(self, -1, temp)
def ReadODBCinfo(self):
st = 'ODBC Server = ' + TestName
self.SetTitle(st)
if TestName == 'YOUNG':
self.DisplayImage('peppermill.jpg')
elif TestName == 'PAYTON':
self.DisplayImage('rainbow.jpg')
elif TestName == 'MANTLE':
self.DisplayImage('Montegobay.jpg')
def WriteODBCinfo(self,server):
TestName = server
self.ReadODBCinfo()
def OnMenuMontego(self, event):
self.WriteODBCinfo('MANTLE')
def OnMenuPeppermill(self, event):
self.WriteODBCinfo('YOUNG')
def OnMenuRainbow(self, event):
self.WriteODBCinfo('PAYTON')