Giter VIP home page Giter VIP logo

Comments (4)

wiggin15 avatar wiggin15 commented on August 11, 2024 3

This is currently not supported by "infi.systray", but can be achieved by using MENUITEM.fType = MFT_SEPARATOR. I currently don't have time to add this feature properly, but here's a quick-and-dirty patch that adds this capability, by setting an item text to 5 hyphens (-----):

diff --git a/src/infi/systray/win32_adapter.py b/src/infi/systray/win32_adapter.py
index 1b9a9ef..ba4c37e 100755
--- a/src/infi/systray/win32_adapter.py
+++ b/src/infi/systray/win32_adapter.py
@@ -70,6 +70,7 @@ SM_CXSMICON = 49
 SM_CYSMICON = 50
 COLOR_MENU = 4
 DI_NORMAL = 3
+MFT_SEPARATOR = 0x00000800
 
 WPARAM = ctypes.wintypes.WPARAM
 LPARAM = ctypes.wintypes.LPARAM
@@ -148,6 +149,9 @@ class NOTIFYICONDATA(ctypes.Structure):
 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
     if hbmpItem is not None:
         res.fMask |= MIIM_BITMAP

from infi.systray.

 avatar commented on August 11, 2024

I would love to know this too, does anyone know yet?

from infi.systray.

 avatar commented on August 11, 2024

Many thanks wiggin,
but as a comparative noob I can't make head nor tail of that.
I know you are busy so maybe somebody else
can work out how to implement this from the above.

If someone could work this into a def I would be forever in their debt, metaphorically :-)

from infi.systray.

 avatar commented on August 11, 2024

Oky after getting some help from the python forum https://python-forum.io/Thread-Can-anyone-make-sense-of-this?pid=111107#pid111107

I have made the changes and this works beautifully.
Thanks.

screenshot of separator bars:
https://i.postimg.cc/sf5GFdHM/seperators.png

Pastebin of the changed w32_adaptor.py file which can be found
in your python \Lib\site-packages\infi\systray:

https://pastebin.com/i9L6iUwd

from infi.systray.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.