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.
Feature request: run several codes at the same time.
-
Sometimes I run a web server on my iPad, and I want to test something with the server. But coding or debuging on iPhone is terrible. So I think that feature is useful.
-
@lpl, would just running the server in a separate thread help?
-
@mikael No, I want to debug and use "check style" or "analyze" function as well, while I keep running the server.
-
@mikael And sometimes I just don't want to kill the process. Maybe it takes time to inital it or other reasons.
-
@lpl Try this little script. It runs a code in the background, updating a button in the status bar.
Tapping it will close the script.
You can run another script as usual.
I cant' say that your web server could run so, but it is to be tested.from objc_util import * import ui class MyView(ui.View): def __init__(self): app = UIApplication.sharedApplication() self.bar = app.statusBar() b = self.bar.bounds() sv = self.bar.subviews() for v in sv: if v._get_objc_classname().startswith(b'SUIButton_PY3') or v._get_objc_classname().startswith(b'SUICustomViewNoDrawRect_PY3'): v.removeFromSuperview() del v btn = ui.Button() btn.action = self.button_action btn.x = 200 btn.y = 1 btn.width = 150 btn.height = 18 btn.border_color = 'blue' btn.border_width = 1 self.btn = btn self.frame = btn.frame self.bar.addSubview_(self) self.bar.addSubview_(btn) btn.bring_to_front() self.update_interval = 1 self.n = 0 self.btn.title = 'tap to close '+str(self.n) def update(self): import os import ast import ui self.n = self.n + 1 self.btn.title = 'tap to close '+str(self.n) def button_action(self,sender): # only to close sv = self.bar.subviews() for v in sv: if v._get_objc_classname().startswith(b'SUIButton_PY3') or v._get_objc_classname().startswith(b'SUICustomViewNoDrawRect_PY3'): v.removeFromSuperview() del v self.close() __s=MyView() #dunder retains in globals...
-
-
@cvp That is an idea. But maybe if omz surpport it like python on Windows, I think it would be better. Because I don't want to wrap every code with it just to debug. It is inconvenient.
-
Sorry, I just forgot that on Windows we can open the app several times and run several codes at the same time. But on ios, we can just open once. But can you support this feature? @omz I think it would be great.
-
you could also define your own wrench action that runs a script in a thread, so that you don't have to decorate.
On windows you have subprocess. Apple does not allow separate processes on iOS. so you are limited to what you can do with threads.
-
You can also run Pythonista in normal mode together with in appex mode, at the same time.
Assume, you run your web server in appex mode and that you test your web cliënt in normal mode.In SplitView...
-
@JonB "iPad is more powerful than a computer." lol
-
@lpl Perhpas does Apple hope that you buy a second iPad 😂
One for your web server, another one for your web client...