• guran

    Thank you for your response...
    Using a view as a list and managing the button as an item is new to me ... like so much else unfortunately. I will try to transfer it to my script where I use multiple views that are displayed using ”bring_to_front ()”, so that's the technique I probably need to use in the function ”b1_action” to display the image in a new view.
    Still have trouble with understanding how to handle the different views and at the same time reach them from each other so it might be that I will raise new questions:)

    posted in Pythonista read more
  • guran

    I'm trying to create a logic where I have two buttons in a view. Using two additional buttons, I want to scroll through the background images of the first two buttons based on a list that contains the names of different images. Then I should be able to click on the respective image to open another view showing something relaterade to the image I clicked.

    As a rookie I have struggled with this for a while but do not get the logic to work. Is there anyone who can help me with suggestions on how to do?

    posted in Pythonista read more
  • guran

    @mikael
    Big thanks for the help!
    I can see that it works even though I don't really understand why. As I understand it the objects view1 and 2 are created from the SwitchView class, which in turn is a subclass of the ui.view class. These are added to the object v created directly from the ui.view class. Then view1 and 2 are then added to the object v as subviews.
    If I understand it correctly, why does it work and do you know where I can learn more to understand the logic?

    posted in Pythonista read more
  • guran

    Probably I miss the most fundamental when it comes to managing subviews. Have tried with both bring_to_front / back + hidden but they don't seem to see each other.
    Below is my non-working script... world be grateful to get some concrete tips on how to handle this, if possible?

    import ui
    #import ui, itertools
    
    class SwitchViews(ui.View):
        def __init__(self):
            self.add_subview(ui.View())
            #self.background_color = "blue"
            #self.present('fullscreen')
            
    def view1():
        view_start_lst1=SwitchViews()
        view_start_lst1.present()
        view_start_lst1.background_color = ('red')
        
        def b_tap1(sender):
            view_start_lst1.hidden = True
            view_start_lst2.hidden = False
            #view_start_lst1.send_to_back()
            #view_start_lst2.send_to_front()
        
        b1 = ui.Button()
        b1.title = ' Switch to next view'
        b1.frame = (100,100,300,100)
        view_start_lst1.add_subview(b1)
        b1.action = b_tap1
        
    def view2():
        view_start_lst2=SwitchViews()
        view_start_lst2.present()
        view_start_lst2.background_color = ('green')
        
        def b_tap2(sender):
            view_start_lst2.hidden = True
            view_start_lst1.hidden = False
            #view_start_lst2.send_to_back()
            #view_start_lst2.send_to_front()
        
        b2 = ui.Button()
        b2.title = ' Switch to next view'
        b2.frame = (400,100,300,100)
        view_start_lst2.add_subview(b2)
        b2.action = b_tap2
        
    SwitchViews()
    view1()
    view2() ```

    posted in Pythonista read more
  • guran

    Just started with Pythonista and trying to write a script where I can open new ui views (full screen) through buttons on respective view.
    Have tried different ways, trying to load all views at once and then switch using view.send_to_back () / view.bring_to_front (), but dont get it to work. Have also tried to put each view in functions and calling them, then close the old one with view.close (), but neither get this to work.
    Can anyone please explain the best way to solve this?

    posted in Pythonista read more
  • guran

    I've just started working with Pythonista and am trying to write a script that will start by posting a background image and then a number of buttons that will open new windows with new content if you press any of them... I want it to work on iPad and iPhone.
    Can I get advice if it is most appropriate to choose "scene" or "ui" to work with?
    Also if someone maybe have a simple script to share, that I can start from, so I understand the structure , would be grateful?

    posted in Pythonista read more
  • guran

    Thank you so much for your help ... now I have managed to move on

    posted in Pythonista read more
  • guran

    Just got started with pythonista and I have succeeded in writing a script that presents an image from the examples found in pythonista, but instead I want to use one of my own pictures but fails to import it into pythonista. Have saved an image from photos to the folder app on the iPad but the image file is grayed out when I try to open it as an external file from pythonista.

    Have also tried to share the image directly from photos, selecting the option ”run pythonista script" but gets no option to import any file so I do not understand how to do.

    Can someone please help me move forward?

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!