Particle Panel crash on start + my solution

Hi,
I couldn’t start up Particle Panel since Python Mega Widgets crashed during startup.
The problem seems to lie with PMW and not with panda but I couldn’t find any forum for PMW to ask anyone about it so I figured I post my solution here instead. Anyway here’s the stack trace when trying to start up particle_panel.py :

Traceback (most recent call last):
File “particle_panel.py”, line 30, in
pp = ParticlePanel() # Create the panel
File “C:\Users\wew\AppData\Local\Programs\Python\Python35\lib\site-packages\direct\tkpanels\ParticlePanel.py”, line 68, in init
AppShell.init(self)
File “C:\Users\wew\AppData\Local\Programs\Python\Python35\lib\site-packages\direct\tkwidgets\AppShell.py”, line 100, in init
self.__createInterface()
File “C:\Users\wew\AppData\Local\Programs\Python\Python35\lib\site-packages\direct\tkwidgets\AppShell.py”, line 122, in __createInterface
self.createInterface()
File “C:\Users\wew\AppData\Local\Programs\Python\Python35\lib\site-packages\direct\tkpanels\ParticlePanel.py”, line 202, in createInterface
self.mainNotebook = Pmw.NoteBook(interior)
File “C:\Users\wew\AppData\Local\Programs\Python\Python35\lib\site-packages\Pmw\Pmw_2_0_1\lib\PmwNoteBook.py”, line 60, in init
Pmw.Color.bordercolors(self,self[‘hull_background’])
File “C:\Users\wew\AppData\Local\Programs\Python\Python35\lib\site-packages\Pmw\Pmw_2_0_1\lib\PmwColor.py”, line 361, in bordercolors
‘#%04x%04x%04x’ % (lightRGB[0], lightRGB[1], lightRGB[2]),
TypeError: %x format: an integer is required, not float

As you can see the problem is that python expects lightRGB[0], lightRGB[1] and lightRGB[2] to be of type integer but they are actually floats.
So my simple fix is then to go into the file PmwColor.py at
“C:\Users\wew\AppData\Local\Programs\Python\Python35\lib\site-packages\Pmw\Pmw_2_0_1\lib\PmwColor.py”

At line 361 we find:

return (
    '#%04x%04x%04x' % (lightRGB[0],lightRGB[1], lightRGB[2]),
    '#%04x%04x%04x' % (darkRGB[0], darkRGB[1], darkRGB[2])
)

here I just cast the values into integers:

return (
    '#%04x%04x%04x' % (int(lightRGB[0]),int(lightRGB[1]), int(lightRGB[2])),
    '#%04x%04x%04x' % (int(darkRGB[0]), int(darkRGB[1]), int(darkRGB[2]))
)

and save the file.

After this ParticlePanel started up just fine.
I know most of you would spot and fix this problem in an instant but for other dummies out there like myself I hope this could be helpful.