Hello, I am fairly new to working with Linux and coding, and have been trying python for only a few days.
I am trying to use the “‘mouse.get_position()” function from the Mouse Module but am having some difficulties.
Issues:
- First Problem – If I run the following code the mouse position will only update if my mouse is INSIDE the PyCharm program window, and the moment my mouse leaves that window it just updates with the last position the mouse was in, when inside the window. (I can resize the window while the program is running and it will still only update while the mouse cursor is inside)
- Second Problem – Running the same code but instead in the Linux terminal wont even update the the mouse position anymore and only repeat the last position the mouse was in when running the program.
Code:
import mouse import time while True: mouse_x, mouse_y = mouse.get_position() print(f'X:{mouse_x}, Y:{mouse_y}') time.sleep(0.25)import mouse
Important Notes??:
I am running on the latest version of Ubuntu (fresh install and to my knowledge all packages updated)
The python project is running in a virtual environment
(also if anyone wants I could screen record my issues to possibly share it that way)
submitted by /u/i_count_sheepatwork
[link] [comments]
r/learnpython Hello, I am fairly new to working with Linux and coding, and have been trying python for only a few days. I am trying to use the “‘mouse.get_position()” function from the Mouse Module but am having some difficulties. Issues: First Problem – If I run the following code the mouse position will only update if my mouse is INSIDE the PyCharm program window, and the moment my mouse leaves that window it just updates with the last position the mouse was in, when inside the window. (I can resize the window while the program is running and it will still only update while the mouse cursor is inside) Second Problem – Running the same code but instead in the Linux terminal wont even update the the mouse position anymore and only repeat the last position the mouse was in when running the program. Code: import mouse import time while True: mouse_x, mouse_y = mouse.get_position() print(f’X:{mouse_x}, Y:{mouse_y}’) time.sleep(0.25)import mouse Important Notes??: I am running on the latest version of Ubuntu (fresh install and to my knowledge all packages updated) The python project is running in a virtual environment (also if anyone wants I could screen record my issues to possibly share it that way) submitted by /u/i_count_sheepatwork [link] [comments]
Hello, I am fairly new to working with Linux and coding, and have been trying python for only a few days.
I am trying to use the “‘mouse.get_position()” function from the Mouse Module but am having some difficulties.
Issues:
- First Problem – If I run the following code the mouse position will only update if my mouse is INSIDE the PyCharm program window, and the moment my mouse leaves that window it just updates with the last position the mouse was in, when inside the window. (I can resize the window while the program is running and it will still only update while the mouse cursor is inside)
- Second Problem – Running the same code but instead in the Linux terminal wont even update the the mouse position anymore and only repeat the last position the mouse was in when running the program.
Code:
import mouse import time while True: mouse_x, mouse_y = mouse.get_position() print(f'X:{mouse_x}, Y:{mouse_y}') time.sleep(0.25)import mouse
Important Notes??:
I am running on the latest version of Ubuntu (fresh install and to my knowledge all packages updated)
The python project is running in a virtual environment
(also if anyone wants I could screen record my issues to possibly share it that way)
submitted by /u/i_count_sheepatwork
[link] [comments]