File: wmod.py

package info (click to toggle)
urwid 3.0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,232 kB
  • sloc: python: 29,010; javascript: 382; sh: 34; makefile: 22
file content (16 lines) | stat: -rw-r--r-- 577 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from __future__ import annotations

import urwid


class QuestionnaireItem(urwid.WidgetWrap[urwid.GridFlow]):
    def __init__(self) -> None:
        self.options: list[urwid.RadioButton] = []
        unsure = urwid.RadioButton(self.options, "Unsure")
        yes = urwid.RadioButton(self.options, "Yes")
        no = urwid.RadioButton(self.options, "No")
        display_widget = urwid.GridFlow([unsure, yes, no], 15, 3, 1, "left")
        super().__init__(display_widget)

    def get_state(self) -> str:
        return next(o.label for o in self.options if o.state is True)