Hold down a button [closed] - python

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I want to execute a method when the button pressed and executes another method when it released. I searched a lot in the Internet and didn't understand how to do it, how can I do that ?

You can bind actions to specific functions with the following example. on_press and on_release are functions, you don't have to call them with () , they will automatically run.
button.bind("<ButtonPress>", on_press)
button.bind("<ButtonRelease>", on_release)

Related

How to temporarily hide the main window PyQt5? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have removed the title of the main window.
Created a button that should hide the window, but not close it. How can I implement a similar function for her?
I guess you want something to minimize application
like this button :
To minimize your application you should call showMinimized(); function.
look at this Qt Documentation link :
https://doc.qt.io/qt-5/qwidget.html#showMinimized

how can I observe a change in a python var [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
Hi I'm trying to catch the change in the paperclip of my computer with the library pyperclip something same as
url=pyperclip.paste()
I want to create a thread which can append all the urls into a list my script, but I don't know how to could I do it
Thanks for your time and help c:
Did you check the documentation or the source code at all? That's all I did. pyperclip supports waitForPaste and waitForNewPaste methods that can do this.

Drawing Text On Applications [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I really want to draw onto an application window.
For example, I want it to display 'Hello World' on the discord window at the top left. Is this possible?
In order to do that, you will need to download themes from internet for discord, maybe with BetterDiscord or something, then in the css file you will need some simple css knowledge about the coordinates/placement, and the text you want to display.

Tkinter, when button pressed (not released), do command [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm using Python 2.7.13 with Tkinter.
This is part of my program:
PAButton = Tkinter.ButtonPress(PAFrame, text='PA', fg='white', bg='blue')
PAButton.pack()
self.PAButton.bind("<ButtonPress>", self.playPA)
This is the gist of what I am trying to do:
When PAButton is pressed (not released), run the function playPA() as defined earlier in the script.
However, I get this error:
AttributeError: 'module' object has no attribute 'ButtonPress'
How would I correctly accomplish my goal?
There's no such thing as ButtonPress. It's Button.
EDIT: For the .bind() function, instead of "<ButtonPress>", use "<Button-1>".

pyqt5 How to recognize which qpush_button activates the function in this function? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Like in topic. I looking for a way to recognize which qpush_button activates the function in this function.
There are two ways to do this. One is to include some additional data in the function call via partial functions. The other way is to use the Qt sender() method
self.button1.clicked.connect(lambda: self.button_clicked(self.button1))
self.button2.clicked.connect(lambda: self.button_clicked(self.button2))
def button_clicked(self, button):
print button
The other way is to use the sender() method
self.button1.clicked.connect(self.button_clicked)
self.button2.clicked.connect(self.button_clicked)
def button_clicked(self):
print self.sender()

Categories