
Yes I'm 15, so please bare with me while I try to learn Python. I'm also from Denmark, so English isn't even my native language.
Luckily @omz created this amazing app, which honestly have help me learn more than any website like Codecademy.com or Udemy.com
-
uj_jonas
Unfold the pink sheet and press "print traceback" then go into the console
-
-
uj_jonas
@ccc said:
import ui
main = ui.ScrollView(frame=(0, 0, *ui.get_screen_size()))
main.content_size = (1920, 1080)
wv = ui.WebView(frame=(0, 0, *main.content_size))
wv.load_url('http://www.example.com')
main.add_subview(wv)
main.present()Can I do this and still have the
wv_container
? I kinda need my webview inside a separate view :/ -
uj_jonas
I have an iPad 4 with 720p resolution. When I run this code, the webview prevents me from scrolling to the right.
import ui main = ui.View(frame=(0, 0, ui.get_screen_size()[0], ui.get_screen_size()[1])) wv_container = ui.View(frame=(0, 0, 1920, 1080)) wv = ui.WebView(frame=wv_container.frame) wv.load_url('http://www.example.com') wv_container.add_subview(wv) main.add_subview(wv_container) main.present('fullscreen')
-
uj_jonas
So I know the question has been answered, but I just wanted to share this. It's just another approach.
import ui, appex class wvdelegate(object): def webview_did_finish_load(self, webview): html = webview.eval_js('document.documentElement.innerHTML') webview.load_html('<xmp>' + html + r'<\xmp>') webview.delegate = None wv = ui.WebView() wv.load_url(appex.get_url()) wv.delegate = wvdelegate() wv.present()
You could also do like this to copy the HTML
import ui, appex, clipboard class wvdelegate(object): def webview_did_finish_load(self, webview): self.html = webview.eval_js('document.documentElement.innerHTML') webview.load_html('<xmp>' + self.html + r'<\xmp>') webview.delegate.webview_did_finish_load = None wv.right_button_items = [ui.ButtonItem(image=ui.Image('iob:clipboard_32'), action=lambda x: clipboard.set(wv.delegate.html))] wv = ui.WebView() wv.load_url(appex.get_url()) wv.delegate = wvdelegate() wv.present()
-
-
uj_jonas
I wanted to convert HTML to PDF and looked it on Google. I found the pdfkit docs, but when I tried using it
import pdfkit pdfkit.from_url('https://google.com', sys.argv[0][:-7] + 'out.pdf')
I got a PermissionError
My guess is it's just iOS restricting me, but I'd like to know if I'm doing something wrong.
-
uj_jonas
Awesome :D definitely going to be using this. I just made a few changes to it, so that it writes it in the editor directly instead of copying it to the clipboard.
Also, I just have to know, what keyboard are you using?
-
uj_jonas
@happy_variable
I don't know why you get that error, but tryappex.get_attachments()[0]
instead ofappex.get_image()
That did it for me :/Oh, and remove the
str()
aroundimg
on the line you get the error -
uj_jonas
@NickAtNight Yes. In Python 3 print is a function.
If you want to run your script to run in Python 2 you could add
#! python2
at the top of your script like this:#! python2 var = raw_input('using raw_input()') print 'python 2 print'
You can also test your script in Python 2 by holding down the play button and choosing "Run with Python 2.7"