Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Execute full script
Hi dear users, in this code my function detects mouse click and while loop is refreshing x and y positions of mouse. I need these values together but my program is not executing. When i put while loop up, only while loop works. When i put function up, only function works. How to run them together ?
Thank you

import win32gui
from pynput.mouse import Listener
import time

counter = 0
def on_click(x, y, button, pressed):
    if pressed:
        global counter
with Listener(on_click=on_click) as listener:

while True:
    x, y = win32gui.GetCursorPos()

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Execute DBCC CHECKDB from python script susja 1 140 Aug-12-2020, 02:09 AM
Last Post: susja
  Trying to write and execute first Python script garvind25 3 349 May-23-2020, 07:36 PM
Last Post: garvind25
  Execute script in IDLE with parameters Pavel_47 11 782 Mar-14-2020, 05:41 AM
Last Post: Larz60+
  How to write a script to execute a program need passing additional input? larkypython 2 541 Nov-23-2019, 04:38 AM
Last Post: larkypython
  Pyinstaller with Sys.Argv[] - “Failed to Execute Script”? ironfelix717 0 1,174 Aug-07-2019, 02:29 PM
Last Post: ironfelix717
  Help with PyInstaller + Script "Failed to Execute Script" ironfelix717 2 5,688 Jul-31-2019, 02:18 PM
Last Post: ironfelix717
  Pyinstaller can not execute script. negru555 0 824 Jan-27-2019, 05:15 PM
Last Post: negru555
  Why the file is not downloaded in full with this script? Jacklops 2 759 Jan-07-2019, 09:33 AM
Last Post: DeaD_EyE
  Pyinstaller to execute a script in command prompt Ciroxxx 0 879 Sep-18-2018, 10:17 AM
Last Post: Ciroxxx
  cant execute a script without prefixing with python3 hunnimonstr 1 1,492 Jul-05-2017, 04:42 PM
Last Post: wavic

Forum Jump:

Users browsing this thread: 1 Guest(s)