本文整理汇总了Python中FxStudio.createStyledScrolledWindow方法的典型用法代码示例。如果您正苦于以下问题:Python FxStudio.createStyledScrolledWindow方法的具体用法?Python FxStudio.createStyledScrolledWindow怎么用?Python FxStudio.createStyledScrolledWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FxStudio
的用法示例。
在下文中一共展示了FxStudio.createStyledScrolledWindow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_controls
# 需要导入模块: import FxStudio [as 别名]
# 或者: from FxStudio import createStyledScrolledWindow [as 别名]
def create_controls(self):
self.DestroyChildren()
# Create the scrolled window.
scrolled_window = FxStudio.createStyledScrolledWindow(self, wx.ID_ANY)
scrolled_window.SetBackgroundColour(self.colors['UIFaceColour'])
# Create the sizer to hold any elements that should be scrolled.
scrolled_sizer = wx.BoxSizer(wx.VERTICAL)
self.button_map = dict()
for index, plugin in enumerate(self.plugin_manager.plugins):
# Create the labeled text fields.
name_label, name_text = self._create_labeled_text(
scrolled_window, 'Name:', '{0} {1}'.format(
plugin.name, plugin.version),
self._color_for_state(plugin.loaded))
author_label, author_text = self._create_labeled_text(
scrolled_window, 'Author:', plugin.author,
self._color_for_author(plugin.author))
desc_label, desc_text = self._create_labeled_text(
scrolled_window, 'Desc:', plugin.description)
button_id = wx.NewId()
load_button = FxStudio.createStyledButton(scrolled_window,
button_id, self._label_for_state(plugin.loaded))
self.button_map[button_id] = (plugin, name_text, load_button)
self.Bind(wx.EVT_BUTTON, self.on_plugin_button, id=button_id)
# Place the labeled text fields into a flex grid sizer.
grid_sizer = wx.FlexGridSizer(4, 2)
grid_sizer.AddGrowableCol(1)
grid_sizer.Add(name_label, 0, wx.ALL, 2)
grid_sizer.Add(name_text, 0, wx.ALL, 2)
grid_sizer.Add(author_label, 0, wx.ALL, 2)
grid_sizer.Add(author_text, 0, wx.ALL, 2)
grid_sizer.Add(desc_label, 0, wx.ALL, 2)
grid_sizer.Add(desc_text, 0, wx.ALL, 2)
grid_sizer.AddSpacer(0) # gap the label cell
grid_sizer.Add(load_button, 0, wx.TOP | wx.RIGHT | wx.ALIGN_RIGHT, 8)
# Add the grid to the scroll window.
scrolled_sizer.Add(grid_sizer, 0, wx.GROW, 0)
scrolled_sizer.AddSpacer(8)
if index != len(self.plugin_manager.plugins) - 1:
scrolled_sizer.Add(_Divider(scrolled_window), 0, wx.GROW, 0)
scrolled_sizer.AddSpacer(5)
scrolled_window.SetSizer(scrolled_sizer)
# Create the buttons.
refresh_id = wx.NewId()
refresh_button = FxStudio.createStyledButton(self, refresh_id, 'Refresh')
ok_button = FxStudio.createStyledButton(self, wx.ID_OK, 'Dismiss')
# Add the buttons and scroll window to the main sizer.
main_sizer = wx.BoxSizer(wx.VERTICAL)
main_sizer.Add(refresh_button, 0, wx.GROW | wx.ALL, 5)
main_sizer.Add(_Divider(self), 0, wx.GROW | wx.LEFT | wx.RIGHT, 5)
main_sizer.Add(scrolled_window, 1, wx.GROW | wx.LEFT | wx.RIGHT, 5)
main_sizer.Add(_Divider(self), 0, wx.GROW | wx.LEFT | wx.RIGHT, 5)
main_sizer.Add(ok_button, 0, wx.GROW | wx.ALL, 5)
# Set the dialog's sizer.
self.SetSizer(main_sizer)
# Bind the refresh button event.
self.Bind(wx.EVT_BUTTON, self.on_refresh_button, id=refresh_id)