English 中文(简体)
目前在urwid/python2.6中展示的清单箱的内容变化
原标题:Changing contents of currently displayed listbox in urwid/python2.6
  • 时间:2010-01-26 03:24:09
  •  标签:
  • python
  • urwid

I m 书写一只音乐家,使用ur子。 我打算在一个简单的ListWalker上把目前的游戏列入一个名单箱,然后是一栏、一栏和最后一个框架。

我如何用其他东西取代该清单箱的全部内容(或简单的ListWalker)?

相关守则:

class mainDisplay(object):
...
    def renderList(self):
       songList = db.getListOfSongs()
       songDictList = [item for item in songList if item[ location ] in 
       commandSh.currentPlaylists[commandSh.plyr.currentList]]
       self.currentSongWidgets = self.createList(songDictList)
       self.mainListContent = urwid.SimpleListWalker([urwid.AttrMap(w, None, 
        reveal focus ) for w in self.currentSongWidgets])
    def initFace(self):#this is the init function that creates the interface
        #on startup
        ...
        self.scanPlaylists()
        self.renderList()
        self.mainList = urwid.ListBox(self.mainListContent)
        self.columns = urwid.Columns([self.mainList, self.secondaryList])
        self.pile = urwid.Pile([self.columns, 
        ("fixed", 1, self.statusDisplayOne), 
        ("fixed", 1, self.statusDisplayTwo), 
        ("fixed", 1, self.cmdShInterface)], 3)
        self.topFrame = urwid.Frame(self.pile)

正式编码: - 接口代码核对表。

如今,《刑法》状况极差,我只为两个月的方案规划工作。 对你可能提出的任何关于密码风格、布局或任何其他方面的建议都非常赞赏。

最佳回答
self.mainListContent[:] = [new, list, of, widgets]

替代现有的植被清单。

如果你希望作出更快的答复,那么你就会把问题放在邮寄名单或国际难民委员会频道上!

问题回答

暂无回答




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签