• Thank you for your help. vidmate download instasave

  • @satsuki.kojima could you try this one please

    import ui class Test(ui.View): def __init__(self, frame): self.frame = frame self.bg_color = 'white' btn = ui.Button(frame=(100,100,100,30), title='Open pop', action = self.onBtn) self.label = ui.Label(frame=(100,200,400,30), border_width=1, name='label') self.add_subview(btn) self.add_subview(self.label) tf = ui.TextField(name='TextField') tf.frame = self.label.frame tf.hidden = True tf.delegate = self tf.placeholder = 'type here' self.add_subview(tf) def textfield_did_end_editing(self, textfield): self['label'].text = textfield.text textfield.hidden = True def onBtn(self, sender): self.label.text = 'calling pop' self['TextField'].hidden = False self['TextField'].bring_to_front() self['TextField'].begin_editing() if __name__ == '__main__': w, h = ui.get_screen_size() v = Test((0,0,w,h)) v.present('sheet')
  • @JonB @cvp
    Thank you for the suggestions! I ended up going the easy way and requiring to pass in the master view. Kept the TableView hidden on the master (and thus un-touchable) until the combobox is touched.

  • Search for Xcode in the forum.
    I used the @Romspy post successfully to publish an app. Check this thread:

  • @cvp that was exactly what I needed. I thought label is what should be used but had no success sending my string. Turns out I was only missing the .text - Thank you!

  • Python2 vs Python3 :)

  • @Enez-Houad before the present() yes, not after (I think)

    import ui v = ui.View() v.frame = (0,0,600,100) v.present('sheet')
  • You may be interested in my objc viewbrowser:

    You can present your view, then traverse the heirarchy to see all of the UIViews. Tapping an item highlights it onscreen.
    Also, any action/targets are shown as little chain icons, which you can tap and it prints to the console the details on the target, selector, event codes, etc. Tapping the info button shows all of the objc properties, which is also navigatable.

  • @shinyformica try this, it is the way omz wrote dialog: using wait_modal and resetting the view just after.

    import ui from objc_util import * class Popover(ui.View): def __init__(self, *args, **kws): ui.View.__init__(self, *args, **kws) self.width = 200 self.height = 50 self.label = ui.Label() self.label.text = "test" self.add_subview(self.label) self.label.x = 0 self.label.y = 0 self.label.width = self.width self.label.height = self.height def will_close(self): print("popover closing") class MyView(ui.View): def __init__(self, *args, **kws): ui.View.__init__(self, *args, **kws) self.popover = None self.button = ui.ButtonItem() self.button.title = "Show Popover" self.button.action = self.showPopover self.right_button_items = (self.button,) def showPopover(self, sender): print("show popover") if self.popover is None: self.popover = Popover() self.popover.present(style="popover", popover_location=(self.width-100,50), hide_title_bar=True) self.popover.wait_modal() self.popover = None def run(): v = MyView() v.present('full_screen') if __name__ == '__main__': run()```
  • Thanks everyone,
    @JonB You cleared my doubt on @ui.in_background, Now I'm using threading instead of ui.in_background

    import ui,threading as thr class view(): def __init__(self): self.flag = True content = ui.TableViewCell() play = ui.Button(frame = (259,0,50,content.height)) pause = ui.Button(frame = play.frame) play.image = ui.Image('iob:ios7_play_256') pause.image = ui.Image('iob:pause_256') pause.hidden = True play.action = self.Play pause.action = self.Pause label = ui.Label(frame =(0,0,0,content.height)) label.touch_enabled = False label.background_color = 'blue' self.play = play self.pause = pause self.label = label self.flag = False content.content_view.add_subview(play) content.content_view.add_subview(pause) content.content_view.add_subview(label) self.content = content def table(self): return self.content def Play(self,sender): t = thr.Thread(target=self.Playy,args=(sender,)) t.daemon = True t.start() def Pause(self,sender): t = thr.Thread(target=self.Pausee,args=(sender,)) t.daemon = True t.start() def Playy(self,sender): sender.hidden = True self.pause.hidden = False import time for a in range(320): self.label.width = a time.sleep(0.1) if self.flag: self.flag = False return def Pausee(self,sender): sender.hidden = True self.play.hidden = False self.flag = True class Llist(): def tableview_number_of_rows(self,t,s): return 40 def tableview_cell_for_row(self,t,s,r): return view().table() a=ui.TableView() a.data_source = Llist() a.allows_selection = False a.present()
  • @yas self is a delegate... It has no bgcolor!

    There is not an easy way to change the section header background color. There are some ways using objc_util, but you may want to crawl first before you walk... .

    The easiest approach is to keep track of headers on your own, and just create a cell instead of a section header.

  • Here is a way to capture all notifications:

    This could be modified to observe a specific object, selector, etc. I believe there is a notification when a view is shown, but i didnt see an obvious one when the X is pushed.

    The confusing thing about what you are asking is that sheet is already basically modal, since it blocks anything else happening. in which case wait_modal might be what you want.

    For truly non-modal "windows", you might consider the Overlay, found here. This lets you create resizable views that float, and you can use connect to register actions that get called when the view is closed.

    Finally, it would be possible to delete the standard X, and replace it with your own button.


    gives me the X button on ipad when presenting as sheet. This might be different on iPhone, and might be different if you have leftbuttonitems or rightbuttonitems defined.

    But this lets you, for instance, hide the default X, and define your own using right_button_items.

    v=ui.View() def c(sender): v.close() print('closed') v.right_button_items=[ui.ButtonItem(action=c,title='X')] v.present('sheet') v.objc_instance.superview().superview().superview().subviews()[1].subviews()[1].hidden=True
  • Thank u so much!!! I was going crazy already...

  • Those are custom attributes not custom arguments. what happens is the view is created, with no input args:


    then, arguments are set:

    v.width =.... v.bc="oooo"

    and so on.
    if you need to take action based on the custom attributes, you need to have those as @property's, to implement a setter.

  • @psyFi, call size_to_fit on the label. Your enclosing view probably needs to be custom so that you can implement the layout method where you first size the label and then position the image. If your text changes a lot, you might also implement a text property for the enclosing class, where you can set the label text and then call size_to_fit on the enclosing view, or just the repositioning code directly.

  • Ah. Everything works now. Thank you!

  • If not running the Pythonista 3 beta, you can get periodic updates with the code below.

    This is not my idea, I just simplified an idea in the TimedRefreshView.py example program, written by cclauss, that I found at:

    My program, named "say_random_digit.py", says a random digit from 0 to 9 every 5 seconds.

    I had to change the data member "self.update_interval" to "self.updatex_interval" and the method "update" to "updatex" so as not to conflict with the names in the Pythonista 3 beta, which I am currently running.

    I like having this functionality built into the ui.View class much more than having to implement it, so I look forward to the beta becoming the released product.

    import ui import threading import speech from random import randint class TimedUpdateView(ui.View): """ This class contains a method named updatex, which is periodically called. """ def __init__(self): self.updatex_interval = 5 self.update_after_delay() def updatex(self): """ Say a random digit from 0 to 9 every 5 seconds. """ speech.say('%s' % (randint(0, 9))) def update_after_delay(self): """ This method calls the updatex method periodically """ self.updatex() update_thread = threading.Timer(self.updatex_interval, self.update_after_delay).run() if __name__ == "__main__": v = TimedUpdateView() v.present('sheet')
  • In the line that is failing, sender is a ui.Button but you have defined CountDown as a standalone function, not as a method of ui.Button().

    Try CountDown(sender) instead of sender.CountDown()

    Also code format requires the three backticks are on a line by themselves with no other text before or after them on the same line.

Internal error.

Oops! Looks like something went wrong!