本文整理汇总了Python中widget.Widget.setdata方法的典型用法代码示例。如果您正苦于以下问题:Python Widget.setdata方法的具体用法?Python Widget.setdata怎么用?Python Widget.setdata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类widget.Widget
的用法示例。
在下文中一共展示了Widget.setdata方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setcolor
# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import setdata [as 别名]
def setcolor(self, color_pair):
"""
Set the curses color pair that should be used for drawing to the window.
"""
Widget.setcolor(self, color_pair)
# refresh the data when we change the color
Widget.setdata(self, data)
示例2: setdata
# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import setdata [as 别名]
def setdata(self, data):
"""
Set the data for the EditBox.
"""
self.__tb = curses.textpad.Textbox(self.__derwin)
for ch in data.ljust(self.cols):
self.__tb.do_command(ch)
self.__tb.do_command(ord(curses.ascii.ctrl('a')))
Widget.setdata(self, data)
示例3: setdata
# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import setdata [as 别名]
def setdata(self, data):
"""
Update the ListBox data with the given data set.
"""
Widget.setdata(self, data)
# the pad is sized -1 instead of -2 (for borders) because to fill in
# the appropriate color we need an extra column
self.__listwin = curses.newpad(len(data), self.cols-1)
for idx, data in enumerate(self.data):
self.__listwin.addnstr(idx, 0, data.ljust(self.cols-2), self.cols-2, curses.color_pair(self.color_pair))
self.refresh()
示例4: setdata
# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import setdata [as 别名]
def setdata(self, data):
# save the horizontal size needed in the cols variable
self.cols = len(data) + 3
Widget.setdata(self, data)
self.refresh()