omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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.


    How to create stash like panel ui?

    Pythonista
    stash ui
    3
    3
    2228
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • yas
      yas last edited by

      I want to create stash like panel ui and when running stash it does not affect the interpreter and can run other codes , how do I do that?

      1 Reply Last reply Reply Quote 0
      • dgelessus
        dgelessus last edited by

        If you want to show a view as a panel tab, use v.present("panel"). There can be multiple "panel" views at once, so if you present your own view as a panel it will not affect Stash (or the other way around).

        If you want to run your code so it doesn't block the main Python console, you need to run it in a background thread using the threading module. (I think Stash runs all of its code in background threads.)

        1 Reply Last reply Reply Quote 1
        • JonB
          JonB last edited by

          the other trick, if you plan in being able to run other scripts, is you need to bypass global clearing for your code.

          there are a few ways to do this. the best way is to have all of your code in a module that is in site-packages, import the module, then call some main() to show the ui. modules in site-packages don't get cleared when running other code. Other approaches are to ensure everything you need is in a single custom view class, with no use of globals (callbacks should use self, or sender). all methods should explictly import anything that is needed, since imports might dissappear from globals. when you present the custom view, the object won't be cleared until it is explictly closed.

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          Powered by NodeBB Forums | Contributors