Python Forum
Can anyone make sense of this?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can anyone make sense of this?
#5
I get this error:
File "C:\Python367\lib\site-packages\infi\systray\win32_adapter.py", line 152,
in PackMENUITEMINFO
res.fType = MFT_SEPARATOR
UnboundLocalError: local variable 'res' referenced before assignment

I have tried adding res = 0 at the start of the def and rse.ftype = 0,
same error.

I think I have the +++ code in the correct places according to the diff file.

SM_CXSMICON = 49
SM_CYSMICON = 50
COLOR_MENU = 4
DI_NORMAL = 3
MFT_SEPARATOR = 0x00000800
#etc
def PackMENUITEMINFO(text=None, hbmpItem=None, wID=None, hSubMenu=None):
    res = MENUITEMINFO()
    res.cbSize = ctypes.sizeof(res)
    
    if text == "-----":
        res.fType = MFT_SEPARATOR
        return res
    
    res.fMask = 0

#etc.
I only get the error if I have the 5 dashes as a separator "-----".
If I remove them or make a different amount the code runs without error.


Any idea what I have done wrong?

I will look into ndc85430 advice next, but
I haven't a clue how to do that either yet ;-)

Okay I have it working. I 'm not sure what I messed up earlier
but I did it right this time.

Many thanks for your help guys.
[Image: seperators.png]
So much better.
Reply


Messages In This Thread
Can anyone make sense of this? - by steve_shambles - Apr-19-2020, 05:19 AM
RE: Can anyone make sense of this? - by bowlofred - Apr-19-2020, 05:36 AM
RE: Can anyone make sense of this? - by ndc85430 - Apr-19-2020, 05:59 AM
RE: Can anyone make sense of this? - by steve_shambles - Apr-19-2020, 09:26 AM
RE: Can anyone make sense of this? - by buran - Apr-19-2020, 11:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Re writing poste to make sense please help me Nearrivers 10 5,887 Apr-02-2018, 11:52 PM
Last Post: Nearrivers
  These boolean statements don't make sense? Athenaeum 6 5,180 Oct-03-2017, 03:34 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020