我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用wx.VSCROLL。
def _init_Editor(self, prnt): self.Editor = wx.ScrolledWindow(prnt, name="Viewer", pos=wx.Point(0, 0), size=wx.Size(0, 0), style=wx.HSCROLL | wx.VSCROLL) self.Editor.ParentWindow = self # Create a new Viewer
def create_wxwindow(self): res = self.initfn(wx.ScrolledWindow)(self.parent, self.id, self.pos, self.size, self.style, self.name) res.SetScrollRate(self.xrate, self.yrate) res.EnableScrolling((self.style & wx.HSCROLL) != 0, (self.style & wx.VSCROLL) != 0) return res
def __init__(self, parent, title): """Create the pydicom image example's main frame window.""" wx.Frame.__init__(self, parent, id=-1, title="", pos=wx.DefaultPosition, size=wx.Size(w=1024, h=768), style=wx.DEFAULT_FRAME_STYLE | wx.SUNKEN_BORDER | wx.CLIP_CHILDREN) # -------------------------------------------------------- # Set up the menubar. # -------------------------------------------------------- self.mainmenu = wx.MenuBar() # Make the 'File' menu. menu = wx.Menu() item = menu.Append(wx.ID_ANY, '&Open', 'Open file for editing') self.Bind(wx.EVT_MENU, self.OnFileOpen, item) item = menu.Append(wx.ID_ANY, 'E&xit', 'Exit Program') self.Bind(wx.EVT_MENU, self.OnFileExit, item) self.mainmenu.Append(menu, '&File') # Attach the menu bar to the window. self.SetMenuBar(self.mainmenu) # -------------------------------------------------------- # Set up the main splitter window. # -------------------------------------------------------- self.mainSplitter = wx.SplitterWindow(self, style=wx.NO_3D | wx.SP_3D) self.mainSplitter.SetMinimumPaneSize(1) # ------------------------------------------------------------- # Create the folderTreeView on the left. # ------------------------------------------------------------- self.dsTreeView = wx.TreeCtrl(self.mainSplitter, style=wx.TR_LINES_AT_ROOT | wx.TR_HAS_BUTTONS) # -------------------------------------------------------- # Create the ImageView on the right pane. # -------------------------------------------------------- self.imView = wx.Panel(self.mainSplitter, style=wx.VSCROLL | wx.HSCROLL | wx.CLIP_CHILDREN) self.imView.Bind(wx.EVT_PAINT, self.OnPaint) self.imView.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) self.imView.Bind(wx.EVT_SIZE, self.OnSize) # -------------------------------------------------------- # Install the splitter panes. # -------------------------------------------------------- self.mainSplitter.SplitVertically(self.dsTreeView, self.imView) self.mainSplitter.SetSashPosition(300, True) # -------------------------------------------------------- # Initialize some values # -------------------------------------------------------- self.dcmdsRoot = False self.foldersRoot = False self.loadCentered = True self.bitmap = None self.Show(True)
def create_page_items(self, page_sizer, panel, config, gui, key): page_sc_window = wx.ScrolledWindow(panel, id=id_renew(gui), style=wx.VSCROLL) page_sc_window.SetScrollbars(5, 5, 10, 10) sizer = wx.BoxSizer(wx.VERTICAL) joined_keys = MODULE_KEY.join(key) if 'redraw' in gui: for redraw_target, redraw_settings in gui['redraw'].items(): if joined_keys not in self.redraw_map: self.redraw_map[joined_keys] = {} self.redraw_map[joined_keys][redraw_target] = { 'key': None, 'item': None, 'redraw_type': None, 'redraw_trigger': redraw_settings['redraw_trigger'], 'redraw_target': redraw_target, 'get_config': redraw_settings['get_config'], 'get_gui': redraw_settings['get_gui'], 'sizer_parent': sizer, 'panel_parent': page_sc_window, 'all_settings': redraw_settings } for section_key, section_items in config.items(): if section_key in SKIP_TAGS: continue view = gui.get(section_key, {}).get('view', type(section_items)) if view in self.function_map.keys(): data = self.function_map[view] gui_settings = gui.get(section_key, {}).copy() item_keys = key + [section_key] sizer_item = data['function']( panel=page_sc_window, item=section_key, value=section_items, bind=data['bind'], gui=gui_settings, key=item_keys, from_sb=False) if joined_keys in self.redraw_map.keys(): if section_key in self.redraw_map[joined_keys]: self.redraw_map[joined_keys][section_key].update({ 'bind_item': data, 'item': sizer_item, 'redraw_type': view, 'key': item_keys, }) sizer.Add(sizer_item, 0, wx.EXPAND) page_sc_window.SetSizer(sizer) page_sizer.Add(page_sc_window, 1, wx.EXPAND)