• tk_kenkyu

    Hi. Dear @JonB and @enceladus . I am grateful for your help. I looked at some examples of ‘navigation view’ and ‘tableview’ on GitHub.
    I could understand how I can make and run the UI program with Navigation View, and I wrote some prototypes using templates.
    However, I want to get the value of the selected item in the navigation view, but I failed to get it even though I searched how I can.
    Here is a code which I wrote. When I made the program run, the console said ‘AttributeError: 'ShowTableView' object has no attribute 'selected_row'’.
    I'm sorry for the second request but could you teach me how I can change it or show me the templates?

    import console, os, ui
    import ui
    import os
    class ShowTableView(object):
        def __init__(self):
            self.view = ui.load_view("ShowTableView")
            self.view.name = "Select"
            dir_items =(‘a’, ‘b’, ‘c’, ‘d’, ‘e’)
            tv1 = self.view["tableview1"]
            tv1.data_source = tv1.delegate = ui.ListDataSource(dir_items)
            tv1.data_source.delete_enabled = tv1.editing = False
        def bt_dir_action(self, sender):
            sel = self.selected_row
            item = sender.items[sel]
            label.text = item.text 
        def tv1_action(self, sender):
            info = sender.items[sender.selected_row]
            console.alert("info", "\n".join(["{} = {}".format(i, info[i]) for i in info]))

    posted in Pythonista read more
  • tk_kenkyu

    Nice to meet you.
    I’m a beginner for using Python3.
    (I’m a Japanese high school student, so if you aware of some grammatically mistakes, don’t mind.)

    I’m developing a system, using UI on Pythonista3 for iOS.

    I wish that the program works like this.

    1.Start UI module
    2.Select an item from the ‘tableview’ ‘s list.
    3.Get the value of the selected item on procedure2.
    4.Write the value acquired in procedure3 as character string in the specified text file and save it.

    I wrote like ↓, but it didn’t work collectively.
    Could you tell me what is different and how to rewrite it?

    Then, I don’t understand how to use the ‘Navigation View’. (I searched on the Internet...) Can you tell me how to use or tell me the detailed website about this?

    import ui
    def tablewview1(sender):
        sel = sender.selected_row
        item= sender.items[sel]
        label.text = item
        f = open('test.txt', 'w', encoding= 'utf-8')
    nav = ui.NavigationView(view)
    tableview = nav['tableview1']

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!