Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Exporting
-
I currently have a export function for my application, named export()
import ui import webbrowser def export(): url = 'www.youtube.com' webbrowser.open(url) def screenshot_action(sender): v = sender.superview with ui.ImageContext(v.width, v.height) as c: v.draw_snapshot() c.get_image().show() v = ui.load_view() v.present('sheet')
I have a button to use the export function I made with UI, but when I click it it does not do anything. What do I do?
-
Your url needs to start with
http://
orsafari-http://
to get it to open.You may also want to close the view first if you're using
http://
(the built-in web browser). -
Ok thanks
-
If you want to take a screenshot of a webpage, check out ScreenshotWebView.py which loads a webpage and then allows you to save a screenshot of the rendered webpage to the clipboard (NOT to a local file like ScreenshotView.py does.)
-
One other comment,
export
doesn't seem to ever get called. If you are trying to haveexport
as a button action, it must have exactly one free input variable.e.g
def export(sender): ...
for a non-instance method, or
def export(self, sender): ...
if this is inside a class.
Using just
def export()
, the button's action will try to callexport(sender)
, which will generate a TypeError, which the ui code will silently suppress. I've made this mistake more than once, and it is confusing because no warning message is printed!