本文整理汇总了Python中wx.ScrolledWindow方法的典型用法代码示例。如果您正苦于以下问题:Python wx.ScrolledWindow方法的具体用法?Python wx.ScrolledWindow怎么用?Python wx.ScrolledWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.ScrolledWindow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _set_page_size
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScrolledWindow [as 别名]
def _set_page_size(self, scrolled):
# set ScrolledWindow and Panel to available size; enable scrolling, if required
# gets available size for notebook pages
ws, hs = self.notebook.GetSize()
ws -= self._notebook_decoration_size[0]
hs -= self._notebook_decoration_size[1]
w_scrollbar = wx.SystemSettings.GetMetric(wx.SYS_VSCROLL_X) # width a of a scrollbar
panel = [w for w in scrolled.GetChildren() if isinstance(w, wx.Panel)][0]
szr = panel.GetSizer()
if not szr: return
wm, hm = szr.GetMinSize()
if hs<hm:
# best size is smaller than the available height -> enable scrolling
scrolled.SetScrollbars(1, 5, 1, int(math.ceil(hm/5.0)))
panel.SetSize( (ws-w_scrollbar, hm) )
else:
panel.SetSize( (ws, hs) )
示例2: properties_changed
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScrolledWindow [as 别名]
def properties_changed(self, modified):
if not modified or "scrollable" in modified:
if self.scrollable:
if self.klass == 'wxPanel':
self.properties["class"].set('wxScrolledWindow')
self.properties['scroll_rate'].toggle_active(True)
self.properties['scroll_rate'].set_blocked(False)
else:
if self.klass == 'wxScrolledWindow':
self.properties["class"].set('wxPanel')
self.properties['scroll_rate'].toggle_active(False)
self.properties['scroll_rate'].set_blocked(True)
if self.widget and modified:
if "scrollable" in modified and self.properties["scrollable"].previous_value!=self.scrollable:
self.recreate_widget()
elif "scroll_rate" in modified and self.scrollable and isinstance(self.widget, wx.ScrolledWindow):
self.widget.SetScrollRate( *self.properties["scroll_rate"].get_tuple() )
EditStylesMixin.properties_changed(self, modified)
示例3: create_widget
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScrolledWindow [as 别名]
def create_widget(self):
if self.widget:
# re-creating -> use old frame
win = self.widget.GetTopLevelParent()
else:
style = wx.DEFAULT_FRAME_STYLE
if common.pin_design_window: style |= wx.STAY_ON_TOP
win = wx.Frame( common.main, -1, misc.design_title(self.name), size=(400, 300), style=style )
import os, compat
icon = compat.wx_EmptyIcon()
xpm = os.path.join(config.icons_path, 'panel.xpm')
icon.CopyFromBitmap(misc.get_xpm_bitmap(xpm))
win.SetIcon(icon)
win.Bind(wx.EVT_CLOSE, self.hide_widget) # CLOSE event of the frame, not the panel
if wx.Platform == '__WXMSW__':
win.CentreOnScreen()
if self.scrollable:
self.widget = wx.ScrolledWindow(win, self.id, style=0)
else:
self.widget = wx.Panel(win, self.id, style=0)
self.widget.Bind(wx.EVT_ENTER_WINDOW, self.on_enter)
self.widget.GetBestSize = self.get_widget_best_size
#self.widget.SetSize = win.SetSize
示例4: initialize
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScrolledWindow [as 别名]
def initialize():
"initialization function for the module: returns a wxBitmapButton to be added to the main palette"
common.widget_classes['EditPanel'] = EditPanel
common.widgets['EditPanel'] = builder
common.widgets_from_xml['EditPanel'] = xml_builder
common.widget_classes['EditScrolledWindow'] = EditPanel
common.widgets_from_xml['EditScrolledWindow'] = xml_builder
common.widget_classes['EditTopLevelPanel'] = EditTopLevelPanel
common.widgets_from_xml['EditTopLevelPanel'] = xml_toplevel_builder
common.widget_classes['EditTopLevelScrolledWindow'] = EditTopLevelPanel
common.widgets_from_xml['EditTopLevelScrolledWindow'] = xml_toplevel_builder
# these are for backwards compatibility (may be removed someday...)
common.widgets_from_xml['SplitterPane'] = xml_builder
common.widgets_from_xml['NotebookPane'] = xml_builder
return common.make_object_button('EditPanel', 'panel.xpm', tip='Add a Panel/ScrolledWindow')
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScrolledWindow [as 别名]
def __init__(self, *args, **kwds):
# begin wxGlade: MyPanelScrolled.__init__
kwds["style"] = kwds.get("style", 0) | wx.TAB_TRAVERSAL
wx.ScrolledWindow.__init__(self, *args, **kwds)
self.SetScrollRate(10, 10)
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_1.Add((0, 0), 0, 0, 0)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
self.Layout()
# end wxGlade
# end of class MyPanelScrolled
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScrolledWindow [as 别名]
def __init__(self, *args, **kwds):
# begin wxGlade: MyPanelScrolled.__init__
kwds["style"] = kwds.get("style", 0) | wx.TAB_TRAVERSAL
wx.ScrolledWindow.__init__(self, *args, **kwds)
self.SetScrollRate(10, 10)
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_1.Add((0, 0), 0, 0, 0)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
self.Layout()
# end wxGlade
# end of class MyPanelScrolled
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScrolledWindow [as 别名]
def __init__(self, *args, **kwds):
# begin wxGlade: MyPanelScrolled.__init__
kwds["style"] = kwds.get("style", 0) | wx.TAB_TRAVERSAL
wx.ScrolledWindow.__init__(self, *args, **kwds)
self.SetSize((400, 300))
self.SetScrollRate(10, 10)
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_1.Add((0, 0), 0, 0, 0)
self.SetSizer(sizer_1)
self.Layout()
# end wxGlade
# end of class MyPanelScrolled
示例8: _create_ModuleLibraryEditor
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScrolledWindow [as 别名]
def _create_ModuleLibraryEditor(self, prnt):
self.ModuleLibraryEditor = wx.ScrolledWindow(prnt,
style=wx.TAB_TRAVERSAL | wx.HSCROLL | wx.VSCROLL)
self.ModuleLibraryEditor.Bind(wx.EVT_SIZE, self.OnResize)
self.ModuleLibrarySizer = LibraryEditorSizer(
self.ModuleLibraryEditor,
self.Controler.GetModulesLibraryInstance(),
[
("ImportButton", "ImportESI", _("Import ESI file"), None),
("AddButton", "ImportDatabase", _("Add file from ESI files database"), self.OnAddButton),
("DeleteButton", "remove_element", _("Remove file from library"), None)
])
self.ModuleLibrarySizer.SetControlMinSize(wx.Size(0, 200))
self.ModuleLibraryEditor.SetSizer(self.ModuleLibrarySizer)
return self.ModuleLibraryEditor
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScrolledWindow [as 别名]
def __init__(self, *args, **kwds):
# begin wxGlade: webcamPreviewDialog.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.THICK_FRAME
wx.Dialog.__init__(self, *args, **kwds)
self.panel_1 = wx.ScrolledWindow(self, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
self.previewbitmap = wx.StaticBitmap(self.panel_1, wx.ID_ANY, wx.NullBitmap)
self.previewokbutton = wx.Button(self, wx.ID_OK, "")
self.__set_properties()
self.__do_layout()
# end wxGlade
示例10: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScrolledWindow [as 别名]
def __init__(self, parent, singleton=True, cols=1):
wx.Window.__init__(self, parent, wx.ID_ANY)
self.singleton = singleton
self.boxes = []
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(self.sizer)
self.buttonwin = wx.Window(self)
self.buttonsizer = wx.BoxSizer(wx.HORIZONTAL)
self.buttonwin.SetSizer(self.buttonsizer)
self.sizer.Add(self.buttonwin)
if (not singleton):
self.value = Set()
self.selectall = wx.Button(self.buttonwin, label="select all");
self.selectall.Bind(wx.EVT_BUTTON, self.OnSelectAllNone)
self.buttonsizer.Add(self.selectall)
self.selectnone = wx.Button(self.buttonwin, label="select none");
self.selectnone.Bind(wx.EVT_BUTTON, self.OnSelectAllNone)
self.buttonsizer.Add(self.selectnone)
self.scrolled = wx.ScrolledWindow(self, wx.ID_ANY)
self.sizer.Add(self.scrolled, proportion=1, flag=wx.EXPAND|wx.ALL)
fontsz = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPixelSize()
self.scrolled.SetScrollRate(fontsz.x, fontsz.y)
self.scrollsizer = wx.GridSizer(cols=cols, hgap=5, vgap=5)
self.scrolled.SetSizer(self.scrollsizer)
示例11: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScrolledWindow [as 别名]
def __init__(self, parent, id = -1):
if wx.Platform != '__WXMAC__': # some problems with this style on macs
wx.Notebook.__init__(self, parent, id, style=wx.NB_BOTTOM)
else:
wx.Notebook.__init__(self, parent, id)
global panel
g.panel = panel = self
self.modified = False
# Set common button size for parameter buttons
bTmp = wx.Button(self, -1, '')
import params
params.buttonSize = (self.DLG_SZE(buttonSize)[0], bTmp.GetSize()[1])
bTmp.Destroy()
del bTmp
# List of child windows
self.pages = []
# Create scrolled windows for pages
self.page1 = wx.ScrolledWindow(self, -1)
sizer = wx.BoxSizer()
sizer.Add(wx.BoxSizer()) # dummy sizer
self.page1.SetAutoLayout(True)
self.page1.SetSizer(sizer)
self.AddPage(self.page1, 'Properties')
# Second page
self.page2 = wx.ScrolledWindow(self, -1)
self.page2.Hide()
sizer = wx.BoxSizer()
sizer.Add(wx.BoxSizer()) # dummy sizer
self.page2.SetAutoLayout(True)
self.page2.SetSizer(sizer)
# Cache for already used panels
self.pageCache = {} # cached property panels
self.stylePageCache = {} # cached style panels
# Delete child windows and recreate page sizer
示例12: is_visible
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScrolledWindow [as 别名]
def is_visible(self):
if not self.widget: return False
if not self.widget.IsShown() and not isinstance(self.widget, wx.ScrolledWindow): return False
if self.IS_TOPLEVEL:
return self.widget.GetTopLevelParent().IsShown()
parent = self.parent
if parent: return parent.is_visible()
return self.widget.GetParent().IsShown()
示例13: recreate_widget
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScrolledWindow [as 别名]
def recreate_widget(self):
"currently used by EditTopLevelPanel to re-create after switch between ScrolledWindow and Panel"
# also by EditStaticText
old_widget = self.widget
size = self.widget.GetSize()
with self.frozen():
self.parent.destroying_child_widget(self, self.index)
self.create_widget()
if self.IS_TOPLEVEL_WINDOW: self.widget.SetSize(size) # do this for IS_TOPLEVEL only?
old_widget.Hide()
if self.sel_marker:
self.sel_marker.Destroy()
self.sel_marker = None
sizer = old_widget.GetSizer()
if sizer:
self.widget.SetSizer(sizer)
old_widget.SetSizer(None, False)
sizer.SetContainingWindow(self.widget)
self._reparent_widget(sizer)
else:
for child in self.widget.GetChildren():
# actually, for now a panel may only have a sizer as child, so this code is not executed
self._reparent_widget(child)
compat.DestroyLater(old_widget)
self.finish_widget_creation(0)
self.parent.child_widget_created(self, 0)
示例14: _find_widget_by_pos
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScrolledWindow [as 别名]
def _find_widget_by_pos(self, w, x,y, level=1):
"helper for find_widget_by_pos; w is the parent window/widget"
if w.HasMultiplePages():
page = w.GetPage(w.GetSelection())
x0,y0,width,height = w.GetRect()
return self._find_widget_by_pos(page, x-x0,y-y0, level+1)
ret = []
# check the widget itself
if w.IsTopLevel(): # for a Frame, Rect is the screen position
x0,y0,width,height = w.GetClientRect()
else:
x0,y0,width,height = w.GetRect() # c.GetClientRect()
if x0 <= x <= x0+width and y0 <= y <= y0+height:
ret.append(w)
# check the children; these are relative to this widget, so adjust x/y
x -= x0
y -= y0
for c in w.GetChildren():
x0,y0,width,height = c.GetRect() # c.GetClientRect()
if x0 <= x <= x0+width and y0 <= y <= y0+height:
ret.append(c)
if isinstance(c, wx.ScrolledWindow):
ret += self._find_widget_by_pos(c, x-x0,y-y0, level+1)
else:
ret += self._find_widget_by_pos(c, x,y, level+1)
return ret
示例15: start_page
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ScrolledWindow [as 别名]
def start_page(self, name):
# create a ScrolledWindow and a Panel; with only ScrolledWindow, scrolling on gtk 3 does not work
scrolled = wx.ScrolledWindow( self.notebook, name=name)
panel = wx.Panel(scrolled, name="%s properties"%name)
if wx.VERSION[0]<3:
panel.SetBackgroundColour(scrolled.GetBackgroundColour())
return panel