当前位置: 首页>>代码示例>>Python>>正文


Python ListBox.setHeight方法代码示例

本文整理汇总了Python中pyjamas.ui.ListBox.ListBox.setHeight方法的典型用法代码示例。如果您正苦于以下问题:Python ListBox.setHeight方法的具体用法?Python ListBox.setHeight怎么用?Python ListBox.setHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyjamas.ui.ListBox.ListBox的用法示例。


在下文中一共展示了ListBox.setHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: onModuleLoad

# 需要导入模块: from pyjamas.ui.ListBox import ListBox [as 别名]
# 或者: from pyjamas.ui.ListBox.ListBox import setHeight [as 别名]
class SoftChordApp:
    def onModuleLoad(self):
        """
        Gets run when the page is first loaded.
        Creates the widgets.
        """

        self.remote = DataService()
        
        main_layout = VerticalPanel()

        h_layout = HorizontalPanel()
        h_layout.setPadding(10)
        
        songlist_layout = VerticalPanel()
        
        songlist_layout.add(Label("Add New Song:"))
 	

        self.newSongTextBox = TextBox()
	self.newSongTextBox.addKeyboardListener(self)
        songlist_layout.add(self.newSongTextBox)
        
       	self.addSongButton = Button("Add Song")
	self.addSongButton.addClickListener(self)
	songlist_layout.add(self.addSongButton)

        #songlist_layout.add(Label("Click to Remove:"))

        self.songListBox = ListBox()
        self.songListBox.setVisibleItemCount(7)
        self.songListBox.setWidth("300px")
        self.songListBox.setHeight("400px")
        self.songListBox.addClickListener(self)
        songlist_layout.add(self.songListBox)
        
        self.deleteSongButton = Button("Delete")
        self.deleteSongButton.addClickListener(self)
        songlist_layout.add(self.deleteSongButton)
         
        h_layout.add(songlist_layout)
        
        #self.textArea = TextArea()
        #self.textArea.setCharacterWidth(30)
        #self.textArea.setVisibleLines(50)
        #h_layout.add(self.textArea)
        
        #self.scrollPanel = ScrollPanel(Size=("400px", "500px"))
        self.songHtml = HTML("<b>Please select a song in the left table</b>")
        #self.scrollPanel.add(self.songHtml)
        #h_layout.add(self.scrollPanel)
        h_layout.add(self.songHtml)
        
        main_layout.add(h_layout)
        
        self.status = Label()
        main_layout.add(self.status)
        
        RootPanel().add(main_layout)
        
        # Populate the song table:
        self.remote.getAllSongs(self)
    

    def onKeyUp(self, sender, keyCode, modifiers):
        pass

    def onKeyDown(self, sender, keyCode, modifiers):
        pass

    def onKeyPress(self, sender, keyCode, modifiers):
        """
        This functon handles the onKeyPress event
        """
        if keyCode == KeyboardListener.KEY_ENTER and sender == self.newSongTextBox:
            id = self.remote.addSong(self.newSongTextBox.getText(), self)
            self.newSongTextBox.setText("")

            if id<0:
                self.status.setText("Server Error or Invalid Response")

    def onClick(self, sender):
        """
        Gets called when a user clicked in the <sender> widget.
        Currently deletes the song on which the user clicked.
        """
        if sender == self.songListBox:
            song_id = self.songListBox.getValue(self.songListBox.getSelectedIndex())
            self.status.setText("selected song_id: %s" % song_id)
            id = self.remote.getSong(song_id, self)
            if id<0:
                self.status.setText("Server Error or Invalid Response")
        
	elif sender == self.addSongButton:
            id = self.remote.addSong(self.newSongTextBox.getText(), self)
            self.newSongTextBox.setText("")
            if id<0:
                self.status.setText("Server Error or Invalid Response")
 
        elif sender == self.deleteSongButton:
#.........这里部分代码省略.........
开发者ID:academicsam,项目名称:softChord,代码行数:103,代码来源:softchordapp.py


注:本文中的pyjamas.ui.ListBox.ListBox.setHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。