CopyPastor

Detecting plagiarism made easy.

Score: 1; Reported for: Exact paragraph match Open both answers

Possible Plagiarism

Reposted on 2025-03-29
by phpjunkie

Original Post

Original - Posted on 2025-03-29
by phpjunkie



            
Present in both answers; Present only in the new answer; Present only in the old answer;

[moses-palmer](https://github.com/moses-palmer) provided a helping hand on [Issue 108](https://github.com/moses-palmer/pystray/issues/180) and provided a link to the source for left and right mouse clicks.
Here is a link to the [source code](https://github.com/moses-palmer/pystray/blob/1907f8681d6d421517c63d94f425f9cdd74d0034/lib/pystray/_win32.py#L193) for the method being overwritten in the following code. ``` import ctypes from ctypes import wintypes
import pystray from PIL import Image from pystray._util import win32 # noqa

class Icon(pystray.Icon): def __init__(self): super(Icon, self).__init__( name = 'PotPlayer', title = 'PotPlayer', icon = Image.open(fp = r'C:\Users\phpjunkie\Python\Scripts\PotPlayer\PotPlayer.png'), menu = pystray.Menu() )
def _on_notify(self, wparam, lparam): # noqa print(hex(lparam))
# if lparam == win32.WM_LBUTTONUP: # pass # elif self._menu_handle and lparam == win32.WM_RBUTTONUP: # pass
Icon().run() ```
0x200 = hover<BR> 0x201 = left button down<BR> 0x202 = `win32.WM_LBUTTONUP`<BR> 0x203 = left button double click<BR> 0x204 = right button down<BR> 0x205 = `win32.WM_RBUTTONUP`<BR> 0x206 = right button double click <BR><BR> This is everything that is printed on double click minus the 0x200 for hover.<BR> 0x201<BR> 0x202<BR> 0x203<BR> 0x202
Some kind of time difference is going to have to be added if you are going to use both single and double left button click events.
[moses-palmer](https://github.com/moses-palmer) provided a helping hand on [Issues - moses-palmer/pystray](https://github.com/moses-palmer/pystray/issues/180) and provided the source for left and right mouse clicks.
``` import ctypes from ctypes import wintypes
import pystray from PIL import Image from pystray._util import win32 # noqa

class Icon(pystray.Icon): def __init__(self): super(Icon, self).__init__( name = 'PotPlayer', title = 'PotPlayer', icon = Image.open(fp = r'C:\Users\phpjunkie\Python\Scripts\PotPlayer\PotPlayer.png'), menu = pystray.Menu() )
def _on_notify(self, wparam, lparam): # noqa """Handles ``WM_NOTIFY``.
If this is a left button click, this icon will be activated. If a menu is registered and this is a right button click, the popup menu will be displayed. """
print(hex(lparam)) # not part of the source. Simply for displaying the event type. if lparam == win32.WM_LBUTTONUP: # noinspection PyCallingNonCallable self()
elif self._menu_handle and lparam == win32.WM_RBUTTONUP: # TrackPopupMenuEx does not behave unless our systray window is the # foreground window win32.SetForegroundWindow(self._hwnd)
# Get the cursor position to determine where to display the menu point = wintypes.POINT() win32.GetCursorPos(ctypes.byref(point))
# Display the menu and get the menu item identifier; the identifier # is the menu item index hmenu, descriptors = self._menu_handle index = win32.TrackPopupMenuEx( hmenu, win32.TPM_RIGHTALIGN | win32.TPM_BOTTOMALIGN | win32.TPM_RETURNCMD, point.x, point.y, self._menu_hwnd, None) if index > 0: descriptors[index - 1](self)

Icon().run() ```
With `print(hex(lparam))`:<BR> 0x200 = hover<BR> 0x201 = left button down<BR> 0x202 = win32.WM_LBUTTONUP<BR> 0x203 = left button double click<BR> 0x204 = right button down<BR> 0x205 = win32.WM_RBUTTONUP<BR> 0x206 = right button double click <BR><BR> And this is everything that is printed on double click minus the 0x200 for hover.<BR> 0x201<BR> 0x202<BR> 0x203<BR> 0x202

        
Present in both answers; Present only in the new answer; Present only in the old answer;