Stripped down to a bare minimum to show the issues
Main.py
#!/usr/bin/python
import os, sys
import wx
import wx.adv
import wx.lib.scrolledpanel
import json
import pprint
import pickle
from UTListPanel import UTListPanel
============================================================
Main Window Class - PersPlanGUI
============================================================
class PersPlanGUI(wx.Frame):
# ============================================================
# Constructor
# ============================================================
def __init__(self, *args, **kw):
# call super init
super(PersPlanGUI, self).__init__(*args, **kw)
self.sProgramName = "Sample"
self.oWindowSize=wx.Size(1200, 800)
self.aListControllers = []
# create a panel
self.wPanel = wx.Panel(self, style = wx.DEFAULT_FRAME_STYLE & ~(wx.RESIZE_BORDER | wx.MAXIMIZE_BOX), pos=wx.DefaultPosition)
self.wPanel.SetBackgroundColour( wx.Colour( 245, 245, 245 ) )
self.SetMinSize(self.oWindowSize)
self.SetMaxSize(self.oWindowSize)
self.SetSize(self.oWindowSize)
self.SetTitle(f"Sample Window Title")
# create GUI
self.makeGUI()
# Create menu bar
self.makeMenuBar()
self.createRoleControllers()
# ============================================================
#
# GUI Setup
#
# ============================================================
# ----------------------------------------------------
# Build main window GUI
# ---------------------------------------------------
def makeGUI(self):
#
# The People box
#
self.PeopleBox = wx.StaticBox(self.wPanel, label="xxxxxxxxx:", pos=(10,13), size=(380, 693) )
self.wListPanel = wx.lib.scrolledpanel.ScrolledPanel(self.wPanel, pos=(400,60), size=(770, 646))
self.wScrollSizer = wx.GridSizer( 3, 0, 0 )
# ---------------------------------------------------
# Make Menu Bar
# ---------------------------------------------------
def makeMenuBar(self):
# --- File Menu
self.fileMenu = wx.Menu()
self.quitItem = self.fileMenu.Append(102, "&Quit\tCTRL-Q", f"Quit {self.sProgramName}")
self.menuBar = wx.MenuBar()
self.menuBar.Append(self.fileMenu, "&File")
self.SetMenuBar(self.menuBar)
# ============================================================
#
# Event Handlers
#
# ============================================================
# ----------------------------
# onQuit
# ----------------------------
def onQuit(self, event):
self.Close(True)
# ============================================================
#
# Handlers
#
# ============================================================
# ----------------------------
# createRoleControllers
# ----------------------------
def createRoleControllers(self):
# Check if we already have controllers
if len(self.aListControllers)>0:
return
for index in range(0,9):
oCtrl = UTListPanel(self.wListPanel, pos=(0, 0), size=(232,320))
oCtrl.setup(f"Panel #{index}", index, self, [])
self.aListControllers.append(oCtrl)
self.wScrollSizer.AddMany(self.aListControllers)
self.wListPanel.SetSizer(self.wScrollSizer)
self.wListPanel.SetupScrolling()
self.wListPanel.Update()
==========================================================================================================
### ENTRY POINT
==========================================================================================================
if name == ‘main’:
oApp = wx.App()
oMainWindow = PersPlanGUI(None, title="")
# Check for debug option
oApp.SetTopWindow(oMainWindow);
oMainWindow.Show()
oApp.MainLoop()
And UTListPanel.py
#!/usr/bin/python
import os, sys
import wx
#!/usr/bin/python
import os, sys
import wx
import wx.adv
============================================
UTShiftList Class
============================================
class UTListPanel(wx.Panel):
# ----------------------------
# Constructor
# ----------------------------
def __init__(self, *arg, **kw):
wx.Panel.__init__(self, *arg, **kw)
self.oBackgroundColor = wx.Colour( red=235, green=235, blue=235 )
self.SetBackgroundColour(self.oBackgroundColor)
self.bDragging=False
# ----------------------------
# setup
# ----------------------------
def setup(self, sInName, nInDeptId, oInParent, aInShiftsList):
# Snag
self.oParent = oInParent
self.sName = sInName
self.nDeptId = nInDeptId
# The List
self.wList = wx.ListCtrl(self, pos=(10, 10), size=(210, 200), style=wx.LC_REPORT | wx.LC_SINGLE_SEL)
self.wList.InsertColumn(0, self.sName)
self.wList.SetColumnWidth(0, 190)
# The Delete button
self.wDeleteButton = wx.Button(self, label="-", pos=(5, 218), size=(22, 22))
# The Service Popup
self.wServiceLabel = wx.StaticText(self, label="Service:", pos=(40,222), size=(50, 20), style=wx.ALIGN_LEFT)
self.wServicePopup = wx.Choice(self, pos=(90, 218), size=(130, 24))
# Service notes
self.wServiceNote = wx.TextCtrl(self, pos=(10,244), size=(210, 60), style=wx.TE_MULTILINE )