Code Monkey home page Code Monkey logo

Comments (7)

cvpe avatar cvpe commented on July 4, 2024 1

Try this

@ui.in_background
def copy_action(sender):
	#clipboard.set(sender.superview['label1'].text)
	#hud_alert('Copied')
	import console
	if console.alert('Copy warning'):
		clipboard.set(sender.superview['label1'].text)
		hud_alert('Copied')

from pythonista-issues.

cvpe avatar cvpe commented on July 4, 2024 1

I can't find the topic, bad search arguments I guess, if you could already read this one https://forum.omz-software.com/topic/1156/console-input_alert-freeze

from pythonista-issues.

cvpe avatar cvpe commented on July 4, 2024 1

And this one https://forum-new.omz-software.com/topic/1119/can-t-show-an-alert/2

from pythonista-issues.

superrune avatar superrune commented on July 4, 2024

Here’s a reproducible case.

Open up the example file called “ColorMixer.py” under “User Interface”.

Change this function:

def copy_action(sender):
	clipboard.set(sender.superview['label1'].text)
	hud_alert('Copied')

To this:

def copy_action(sender):
	if console.alert('Copy warning'):
		clipboard.set(sender.superview['label1'].text)
		hud_alert('Copied')

The script will hang when you press the ‘Copy’ button.

from pythonista-issues.

superrune avatar superrune commented on July 4, 2024

Thanks! This fixed the problem in my script!

Does this mean @ui.in_background is how you should do it, or is it a workaround?

from pythonista-issues.

cvpe avatar cvpe commented on July 4, 2024

In the past, we did not need this line except in some cases, thus it is a workaround and you could find a very good explanation of @JonB in the forum, if I find it again, I'll post it here

from pythonista-issues.

superrune avatar superrune commented on July 4, 2024

Thanks :)

from pythonista-issues.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.