I am new-ish to python, so bear with me here.
I would like to make an autoclicker that would work on any device with IDLE, if I copy/paste the code, whether or not it has extra libraries (modules?) tacked on.
If it helps, this is for a 2014 MacBook Air.
Ideally, it would look something like this:
if key is pressed:
active = True
while active is True:
(simulate mouse click)
I've seen a similar question, but everyone suggested PyAutoGUI, which is not in the standard library.
I'm not sure whether it's possible to do this, however.
It's pretty simple, except I have no idea how to actually do it.
Related
I tried out many Python libaries including but not limited to: PyDirectInput, PyAutoGui, Clicknium, Autoit, Mouse, PyGame and many more, but only win32api seems to work with win32api.mouse_event(win32con.MOUSEEVENTF_MOVE). The problem with that WinAPI is that it doesn't actually reliably work on all machines, e.g the mouse driver may interfere and make the movement sloppy and make it go all over the place, just like with a high sensitivity. With a high sensitivity it actually doesn't move where you want it to move it actually just moves somewhere random and flicks all over the place. I did an intense amount of research and found no real libary which could achieve actual mouse movement in a game like CS:GO other than the buggy win32api. Do you know any lib that might actually work? Thanks in advance!
Have you tried any of the python bindings for AutoHotkey? I've never really bothered doing anything serious with the python bindings, but AutoHotkey always worked reliably for me when I was doing similar stuff with games. It might be worth a shot. A quick search turned up two potential candidates:
ahk: The more well-known of the two. Skimming through the code, it looks like it's translating the Python calls into an AHK script and running it with the ahk executable.
AutoHotkey.py: Seems to embed python into AHK and executes your Python script after applying some extensions.
I have a question, is it possible to use python to make it so that when pressing the right mouse button, some key on the keyboard is pressed (for example, the G key)
Not sure if this is the best place to ask such question but I'll answer and whatever happens to the thread happens.
From my experience, I think the easiest and most accessible module for keyboard control would be 'keyboard' by BoppreH. I've used it and had no issues. Good cross-platform choice for Windows and Linux, if that's a consideration.
Here are a couple of resources. Should be easy enough to integrate.
A friendly suggestion for next time, friend. Please try looking online first. Happy Coding :)
https://pypi.org/project/keyboard/
https://github.com/boppreh/keyboard
Generally I want to write a program to run in the background on Mac and when I push a keyboard shortcut, the current active window would be resized and positioned to the way I have set.
Something similar to the tool called SizeUp on Mac. I think this shouldn't be difficult to implement and would be fun to take a try.
I would appreciate any resources you could point me to. Thanks.
I think you're going to have an easier time attacking this in applescript. Upon casual googling, this link seems to have more or less what you want. If you were more looking for a programming challenge in python, and less for a solution, then disregard this.
I have made a pygame physics simulation--'a projectile motion' but it lacks interactivity like accepting angle of launch,speed etc. I am wanting to add input boxes with increase decrease arrows but don't know how to go about it. Thanks for the help.
Maybe you can try PGU (Phil's pyGame Utilities).
In addition to other tools, it has a library for creating GUIs.
This PGU demo shows probably something similar to that you are looking for:
Try Some of these:
http://wiki.wxpython.org/IntegratingPyGame
http://www.pygame.org/project-Pygame+embedded+in+wxPython-1580-2788.html
Good luck!
I don't think trying to add wx-Elements is a very pygame way of implementing a GUI, a better (in sense of portable) way would be to use some all-in-python-GUI-extention for pygame. But the issue of GUI in pygame is anoying, since I could not find any library that offeres such a thing.
I know of two interesting approches, first there is Albow (a little bit of widgetry for pygame), which has a nice implementation of styles. The newest Version (which is not very new, I'm afraid) can be found at http://www.cosc.canterbury.ac.nz/greg.ewing/python/Albow/
Then there is OcempGUI http://ocemp.sourceforge.net/gui.html -- which has documentation and an some good concepts of event handling.
The sad thing is, both projects seem to be dead. I know of no other pygame-GUI that is worth looking at (correct my on that one, please!). For my own project I started to build something inspired by both of them (just don't expect that to ever become useable), since I'm not really content with either of the two. But they might by just the thing if you don't want to put too much time into it and want to have a good collection of GUI elements from labels and buttons up to file browsing dialogs or scrollable text fields.
Following the example at http://article.gmane.org/gmane.comp.python.general/541418, I've succeeded in creating a callable class for balloon tooltips, but the greater complexities of that code elude me when it comes to customization. I browsed a bit of how it works through msdn, but being a novice at more windows-esque languagues like c and vb, etc. I was unable to make much sense of it.
So I ask ye snakely academics:
Things I'd like to be able to do with that code aside from the standard icon, title, text:
Perform actions based on clicking the tooltip
Modify the tooltip that pops up over the icon in the system tray after loading it (to reflect changing values)
Multiple lines? (Not sure if this can even be done, really)
More information on other things you could do in a windows 7 environment versus XP (which seems to be what this was written for).
Ideally I'd get some sort of return value or some semblance of an event when the tooltip is clicked so that I could run some code, but currently I'm importing that code as a module and calling at various times, so I'm not sure how to handle clicks outside of the popup code itself...
Information on handling these things with python seems quite scarce. Thanks in advance.
Perform actions based on clicking the tooltip
Whats the problem OnTaskbarNotify? Hock yourself in there.
Modify the tooltip that pops up over the icon in the system tray after loading it (to reflect changing values)
Probably not, I am not sure about the WinAPI here. I haven't seen it in the wild, so...
Multiple lines? (Not sure if this can even be done, really)
With most WinAPI, just insert a \n in the string.
More information on other things you could do in a windows 7 environment versus XP (which seems to be what this was written for).
LOTS... But that is a bit vague... It depends what your needs are. But for kol feturez you need to google on your own...
On Linux and Unix systems I use the notify-send OS already implemented system.
import os
os.system('notify-send "'+title+'" "'+message+'")
Maybe in Windows there is some API32 for this.
Check this https://gist.github.com/wontoncc/1808234