• yas

    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()

    posted in Pythonista read more
  • yas

    The pause button is not working

    import ui
    
    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
        
        @ui.in_background
        def Play(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 
        
        @ui.in_background
        def Pause(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()

    posted in Pythonista read more
  • yas

    I am trying to make a downloader's ui,
    but the problem after it pauses, the progress get resetted when scrolled down and scrolled up.

    import ui
    
    @ui.in_background
    def progress_(sender):
        a=sender.superview
        for f in range(150):
            
            a['progress'].width=f
        return a['progress']
    
    def make():
        a=ui.TableViewCell()
        b=ui.Label(frame=a.content_view.frame)
        c=ui.Label(frame=a.content_view.frame)
    
        c.name='progress'
        c.width=0
        c.bg_color='lightblue'
        h=ui.Button(frame=b.frame)
        h.x=250
        h.width=59
        h.action=progress_
        h.image=ui.Image('iob:arrow_expand_256')
        
        a.add_subview(b)
        a.add_subview(h)
        a.add_subview(c)
        return a
    class listdata():
        def __init__(self):
            self.tv=ui.TableViewCell()
            self.b=ui.Button()
            self.l=ui.Label()
        def tableview_number_of_rows(self,t,s):
            return 20
        def tableview_cell_for_row(self,t,s,r):
            return make()
        
    
    s=ui.TableView()
    s.allows_selection=False
    
    s.data_source=listdata()
    s.present()

    posted in Pythonista read more
  • yas

    On the section header how to change its background color
    But this doesn't work for me

    def tableview_title_for_header(self, tableview, section):
        # Return a title for the given section.
        # If this is not implemented, no section headers will be shown.
        self.background_color='black'
        return 'Some Section'

    posted in Pythonista read more
  • yas

    @JonB Actually I am creating a Downloader like IDM So I am creating this view with a pause and resume button and the label as the progress bar how can I Do this with tableviewcell, An example would be helpful.
    Thanks in advance.

    posted in Pythonista read more
  • yas

    I am trying to create a table without using tableview because tableview doesn't cant help me, so I created a scrollview with a view inside that view is the row, but I am having trouble with view I can't create more than one row.

    view.py

    import ui
    d=ui.load_view()
    def g(text,no):
        
        sv=d['scrollview1']
        v=sv['view1']
        l=v['label1']
        b=v['button1']
        
        l.text=l.background_color=b.background_color=text
        
        v.add_subview(l)
        v.add_subview(b)
        v.frame.y=no*(l.frame.height+5)
        sv.add_subview(v)
        
    for ss,s in enumerate(['red','green'],1):
        g(s,ss)
        
    d.present()
    

    view.pyui

    [
      {
        "class" : "View",
        "attributes" : {
          "background_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)",
          "tint_color" : "RGBA(0.000000,0.478000,1.000000,1.000000)",
          "enabled" : true,
          "border_color" : "RGBA(0.000000,0.000000,0.000000,1.000000)",
          "flex" : ""
        },
        "frame" : "{{0, 0}, {240, 240}}",
        "selected" : false,
        "nodes" : [
          {
            "class" : "ScrollView",
            "attributes" : {
              "class" : "ScrollView",
              "name" : "scrollview1",
              "frame" : "{{-40, -40}, {320, 320}}",
              "uuid" : "41AD7B2A-B5ED-4C74-BA2B-24469DA90229",
              "content_width" : 228,
              "content_height" : 320
            },
            "frame" : "{{6, 19}, {228, 182}}",
            "selected" : true,
            "nodes" : [
              {
                "class" : "View",
                "attributes" : {
                  "class" : "View",
                  "name" : "view1",
                  "uuid" : "03D06CC2-E81C-4D70-B02E-6894CE5EB352",
                  "frame" : "{{64, 110}, {100, 100}}",
                  "background_color" : "RGBA(0.800000,1.000000,0.800000,1.000000)"
                },
                "frame" : "{{0, 0}, {228, 74}}",
                "selected" : true,
                "nodes" : [
                  {
                    "class" : "Label",
                    "attributes" : {
                      "font_size" : 18,
                      "text" : "Label",
                      "font_name" : "<System>",
                      "name" : "label1",
                      "class" : "Label",
                      "alignment" : "left",
                      "frame" : "{{39, 21}, {150, 32}}",
                      "uuid" : "6DFB1E3F-0AE3-4AAA-BDE7-1A33E95AE96A"
                    },
                    "frame" : "{{6, 22}, {150, 32}}",
                    "selected" : true,
                    "nodes" : [
    
                    ]
                  },
                  {
                    "class" : "Button",
                    "attributes" : {
                      "font_size" : 15,
                      "title" : "",
                      "name" : "button1",
                      "corner_radius" : 0,
                      "border_color" : "RGBA(0.700000,1.000000,0.550000,1.000000)",
                      "border_width" : 1,
                      "class" : "Button",
                      "frame" : "{{74, 21}, {80, 32}}",
                      "image_name" : "iob:ios7_play_outline_256",
                      "uuid" : "4D57F024-937D-435D-9099-064D8D644514"
                    },
                    "frame" : "{{174, 13}, {48, 55}}",
                    "selected" : false,
                    "nodes" : [
    
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]

    posted in Pythonista read more
  • yas

    dialogs.form_dialog(title='fu',fields=[{'type':'switch','key':'chrc','title':'yas','tint_color':'linen'}])
    

    How do I use sections?

    posted in Pythonista read more
  • yas

    Can anyone give me examples on dialogs.form() ?

    Thanks in Advance

    posted in Pythonista read more
  • yas

    Thanks ,I used Auto-Lock in settings to 30-Seconds and used

    console.set_idle_timer_disabled(True)
    

    Untill the timer runs out and changed the flag to False.

    posted in Pythonista read more
  • yas

    I am creating a timer after the timer runs out I want to lock the screen .How do I do that?

    posted in Pythonista read more
  • yas

    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?

    posted in Pythonista read more
  • yas

    I've got a text file in pythonista and I opened the file and from the wrench I chose share to Notes but it is sharing as 'File.txt' and not the contents. How do I share the contents of that text file?

    Note : can't use clipboard because file is large

    posted in Pythonista read more
  • yas

    @ccc I want to use kali linux tools like aircrack-ng and other hacking tools . Can you suggest some scripts . And do nmap work with pythonista?

    posted in Pythonista read more
  • yas

    Is monitoring a wifi possible in pythonista, like the wifi sniffing tools, can I do that in Pythonista ?

    Edit
    If you need more info about the question please reply.

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!