0

I'm working on a npyscreen interface and want a popup with a folderselection, but I don't know how to do it. I have a working basic Interface and within menu are 2 Options ("C1" and "C2"). For example: Select C1 -> hit enter -> Popup appears and let me pick a folder. At the second step, the selection should be displayed at the status box: "C1: [selected_folder]"

This is the code for the Interface:

class qmkdevice(npyscreen.NPSApp):
    def main(self):
        F  = npyscreen.Form(name = "DEVICE", lines=20, columns=53)
        column_height = terminal_dimensions()[0] -9
        widget_top = F.add(
            Column,
            name        = "MENU",
            relx        = 2,
            rely        = 7,
            max_width   = 48,
            max_height  = 11,
        )
        widget_bottom = F.add(
            Column,
            name        = "STATUS",
            relx        = 2,
            rely        = 2,
            max_width   = 48,
            max_height  = 5,
        )

        widget_top.values = ["C1", "C2"]
        widget_bottom.values = ["C1:  [   ]", "C2:    [   ]"]
        F.edit()

        print(ms.get_selected_objects())

class Column(npyscreen.BoxTitle):
    def resize(self):
        self.max_height = int(0.73 * terminal_dimensions()[0])

def terminal_dimensions():
    return curses.initscr().getmaxyx()

Thanks for your help.

0x01_PH
  • 126
  • 10

0 Answers0