所以我正在为我创建的脚本创建一个基本的 TUI。目标是收集几个变量,包括目录和文件的路径。我不确定的是,一旦我创建了它的视觉方面,如何让这些信息与代码的其他部分进行交互。
以下是我迄今为止在视觉部分方面的内容(另一部分约为 500 行),老实说,我不知道如何打印类下设置的任何变量,任何指针都会大大赞赏。
#!/usr/bin/env python
# encoding: utf-8
import npyscreen
class PlistCreator(npyscreen.NPSApp):
def main(self):
screen = npyscreen.Form(name="Welcome to Nicks Playlist Creator!")
plistName = screen.add(npyscreen.TitleText, name="Playlist Name:" )
csvPath = screen.add(npyscreen.TitleFilenameCombo, name="CSV Schedule:")
toaPath = screen.add(npyscreen.TitleFilenameCombo, name="Path to ToA Video Folder:", use_two_lines=True)
outputPath = screen.add(npyscreen.TitleFilenameCombo, name = "Output Folder:", use_two_lines=True)
dateOfAir = screen.add(npyscreen.TitleDateCombo, name="Date of Air:")
timeOfStart = screen.add(npyscreen.TitleText, name="Time of Air (TC):")
screen.edit()
if __name__ == "__main__":
App = PlistCreator()
App.run()