Python wx 模块,ScrolledWindow() 实例源码

我们从Python开源项目中,提取了以下11个代码示例,用于说明如何使用wx.ScrolledWindow()

项目:hachoir3    作者:vstinner    | 项目源码 | 文件源码
def __init__(self):
        wx.ScrolledWindow.__init__(self)

        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_SIZE, self.OnResized)
        self.Bind(wx.EVT_SCROLLWIN, self.OnScrolled)
        # OnCreate required to avoid crashing wx in xrc creation
        self.Bind(wx.EVT_WINDOW_CREATE, self.OnCreate)

        # Disable physical scrolling - refresh entire display on each scroll event.
        self.EnableScrolling(False, False)
        # This line enables double-buffered painting for reduced flicker.
        self.SetBackgroundStyle(wx.BG_STYLE_PAINT)

        # The previous scroll action (for maintaining viewport during resizes).
        self.prev_scroll = None

        self.layout = HexViewLayout()
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent):
        self.panel = wx.ScrolledWindow.__init__(self, parent)
        self.SetScrollRate(5, 5)
        self.panelphase = self.GetParent().panelphase
        self.panelvisual = self.GetParent().panelvisual
        self.cmvbox = wx.BoxSizer(wx.VERTICAL)
        self.cmhbox = []
        self.imglist = []
        self.sellist = []
        self.rb = []
        self.chkb = []
        array = self.panelphase.cms[0][1]
        dc = wx.ScreenDC()
        dc.SetFont(self.panelvisual.font)
        w,h = dc.GetTextExtent("TestString")
        height = h
        if IsNotWX4():
            image = wx.EmptyImage(array.shape[0],height)
        else:
            image = wx.Image(array.shape[0],height)
        newarray = numpy.zeros((height, array.shape[0], 3), dtype=numpy.uint8)
        for i in range(self.panelphase.cms.shape[0]):
            self.cmhbox.append( wx.BoxSizer(wx.HORIZONTAL) )
            name = self.panelphase.cms[i][0]
            array = self.panelphase.cms[i][1]
            for j in range(height):
                newarray[j,:,:] = numpy.uint8(255.0*array)
            image.SetData( newarray.tostring())
            bmp = image.ConvertToBitmap()
            self.imglist.append(wx.StaticBitmap(self, -1, bmp))
            self.rb.append( wx.RadioButton(self, -1, label=name, size=(160, height) ) )
            self.cmhbox[-1].Add(self.rb[-1], 0)
            self.cmhbox[-1].Add((5, -1))
            self.cmhbox[-1].Add(self.imglist[-1], 1, wx.EXPAND)
            self.chkb.append( wx.CheckBox(self, -1, 'Reverse', size=(160, height)) )
            self.cmhbox[-1].Add(self.chkb[-1], 0, wx.EXPAND)
            self.cmvbox.Add(self.cmhbox[-1], 1, wx.EXPAND)
        self.SetSizer(self.cmvbox)
        self.Fit()
        self.Layout()
        self.Show()
项目:magic-card-database    作者:drknotter    | 项目源码 | 文件源码
def __init__(self,parent=None,fname=None):
        wx.Notebook.__init__(self,parent,style=wx.TAB_TRAVERSAL)
        self.parent = parent

        if not fname:
            fname = 'my_library.db'
        self.db_conn = sqlite3.connect(fname);
        self.db_conn.row_factory = sqlite3.Row
        self.db_cursor = self.db_conn.cursor();

        self.db_cursor.execute('select * from cards')
        self.my_library = self.db_cursor.fetchall()

        # ***** initialize the my_library tab *****
        self.my_library_tab = wx.ScrolledWindow(self)
        self.my_library_grid = wx.grid.Grid(self.my_library_tab)
        self.my_library_grid.SetMinSize((350,355))
        self.current_row = -1

        my_library_sizer = wx.FlexGridSizer(rows=1,cols=1)
        my_library_sizer.SetMinSize(size=(350,363))
        self.my_library_tab.SetSizer(my_library_sizer)

        self.my_library_grid.CreateGrid(0,0)
        self.my_library_grid.EnableEditing(False)
        self.my_library_grid.SetColLabelSize(wx.grid.GRID_AUTOSIZE)
        self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.change_sort_by)

        self.my_library_fields = ['Card Name','Qty']
        self.my_library_sort_by = ['Card Name','v']

        my_library_sizer.Add(item=self.my_library_grid,flag=wx.EXPAND)
        my_library_sizer.AddGrowableCol(0,1)
        my_library_sizer.AddGrowableRow(0,1)

        self.AddPage(self.my_library_tab,text='My Library')

        self.my_library_grid.Bind(wx.grid.EVT_GRID_SELECT_CELL,self.cell_selected)
        self.update_my_library_grid()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
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
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: sampoorna_win.__init__
        kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.MAXIMIZE | wx.MAXIMIZE_BOX | wx.STAY_ON_TOP | wx.SYSTEM_MENU | wx.RESIZE_BORDER | wx.CLIP_CHILDREN
        wx.Frame.__init__(self, *args, **kwds)
        self.panel_1 = wx.ScrolledWindow(self, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
        self.panel_warning = wx.Panel(self.panel_1, wx.ID_ANY, style=wx.RAISED_BORDER | wx.STATIC_BORDER | wx.TAB_TRAVERSAL)
        self.label_1 = wx.StaticText(self.panel_warning, wx.ID_ANY, _("label_1"))
        self.panel_login = wx.Panel(self.panel_1, wx.ID_ANY)
        self.bitmap_1 = wx.StaticBitmap(self.panel_login, wx.ID_ANY, wx.Bitmap("/home/ghssvythiri/Desktop/about.jpeg", wx.BITMAP_TYPE_ANY))
        self.label_2 = wx.StaticText(self.panel_login, wx.ID_ANY, _("label_2"))
        self.text_ctrl_1 = wx.TextCtrl(self.panel_login, wx.ID_ANY, "")
        self.label_3 = wx.StaticText(self.panel_login, wx.ID_ANY, _("label_3"))
        self.text_ctrl_2 = wx.TextCtrl(self.panel_login, wx.ID_ANY, "", style=wx.TE_PASSWORD)
        self.button_1 = wx.Button(self.panel_login, wx.ID_ANY, _("button_1"))
        self.panel_class = wx.Panel(self.panel_1, wx.ID_ANY)
        self.checkbox_1 = wx.CheckBox(self.panel_class, wx.ID_ANY, _("checkbox_1"))
        self.checkbox_2 = wx.CheckBox(self.panel_class, wx.ID_ANY, _("checkbox_2"))
        self.checkbox_3 = wx.CheckBox(self.panel_class, wx.ID_ANY, _("checkbox_3"))
        self.button_2 = wx.Button(self.panel_class, wx.ID_ANY, _("button_2"))
        self.panel_progress = wx.Panel(self.panel_1, wx.ID_ANY)
        self.panel_report = wx.Panel(self.panel_1, wx.ID_ANY)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.on_next, self.button_2)
        # end wxGlade
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: delete.__init__
        kwds["style"] = wx.MAXIMIZE | wx.CLOSE_BOX | wx.THICK_FRAME|wx.CAPTION
        wx.Dialog.__init__(self, *args, **kwds)
        self.panel_2 = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
        self.label_1 = wx.StaticText(self.panel_2, -1, "Specify Class")
        self.combo_box_1 = wx.ComboBox(self.panel_2, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_READONLY )
        self.combo_box_2 = wx.ComboBox(self.panel_2, -1, choices=["Select Standard", "8", "9", "10"], style=wx.CB_DROPDOWN | wx.CB_READONLY )
        self.combo_box_3 = wx.ComboBox(self.panel_2, -1, choices=['Select Division'], style=wx.CB_DROPDOWN | wx.CB_READONLY )
        self.static_line_2 = wx.StaticLine(self.panel_2, -1)
        self.panel_1 = wx.Panel(self.panel_2, -1)

        self.check_list_box_1 = wx.CheckListBox(self.panel_1, -1, (60, 50), (30,30), ['Admission No                       Name'])
        self.check_list_box_2 = wx.CheckListBox(self.panel_1, -1, (60, 50), wx.DefaultSize, [])
        self.button_close = wx.Button(self.panel_2, -1, "Close")
        self.button_proceed = wx.Button(self.panel_2, -1, "Proceed")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_COMBOBOX, self.oncombo_year, self.combo_box_1)
        self.Bind(wx.EVT_COMBOBOX, self.oncombo_class, self.combo_box_2)
        self.Bind(wx.EVT_COMBOBOX, self.oncombo_div, self.combo_box_3)
        self.Bind(wx.EVT_CHECKLISTBOX, self.on_check, self.check_list_box_1)
        self.Bind(wx.EVT_CHECKLISTBOX, self.on_check_2, self.check_list_box_2)
        self.Bind(wx.EVT_BUTTON, self.on_close, self.button_close)
        self.Bind(wx.EVT_BUTTON, self.on_proceed, self.button_proceed)

        self.checkedItems=()
        self.DB=db_operations()
        self.load_year()
        # end wxGlade
项目:wxWize    作者:AndersMunch    | 项目源码 | 文件源码
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
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self,parent,ancestor):
        from math import pi
        self.ancestor = ancestor
        wx.ScrolledWindow.__init__(self, parent, style=wx.SUNKEN_BORDER)
        vbox = wx.BoxSizer(wx.VERTICAL)
        title = wx.StaticText(self, label="View Support array")
        vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.support = TextPanelObject(self, "Support: ", "",100,'*.npy')
        vbox.Add(self.support, 0,  flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.input_filename = TextPanelObject(self, "Data array: ", "",100,'*.npy')
        vbox.Add(self.input_filename, 0,  flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        vbox.Add((-1, 5))
        self.sbox1 = wx.StaticBox(self, label="Isosurface", style=wx.BORDER_DEFAULT)
        self.sboxs1 = wx.StaticBoxSizer(self.sbox1,wx.VERTICAL)
        self.hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        self.contour_support = SpinnerObject(self,"Support:",1.0,0.0,0.1,0.5,100,100)
        self.hbox1.Add(self.contour_support,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.hbox1.Add((20, -1))
        self.opacity = SpinnerObject(self,"Opacity:",1.0,0.0,0.1,0.5,130,100)
        self.hbox1.Add(self.opacity,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.sboxs1.Add(self.hbox1,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        self.contour = SpinnerObject(self,"Data:",MAX_INT,MIN_INT,1,100,100,100)
        self.hbox2.Add(self.contour,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.hbox2.Add((20, -1))
        self.feature_angle = SpinnerObject(self,"Feature Angle:",180,0,1,90,130,100)
        self.hbox2.Add(self.feature_angle,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.sboxs1.Add(self.hbox2,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.sboxs1.Add((-1, 5))
        vbox.Add(self.sboxs1,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        vbox.Add((-1, 5))
        self.hbox6 = wx.BoxSizer(wx.HORIZONTAL)
        self.chkbox_axes = wx.CheckBox(self, -1, 'View axes', size=(200, 20))
        self.chkbox_axes.SetValue(False)
        self.hbox6.Add(self.chkbox_axes, 1,flag=wx.EXPAND|wx.LEFT|wx.RIGHT, border=2)
        self.hbox6.Add((-1, 5))
        self.axes_fontfactor = SpinnerObject(self,"Font Factor:",MAX_INT,1,1,2,100,100)
        self.hbox6.Add(self.axes_fontfactor, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT, border=2)
        vbox.Add(self.hbox6, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP|wx.BOTTOM, border=2)
        vbox.Add((-1, 5))
        button_view = wx.Button(self, label="View", size=(70, 30))
        button_view.Bind(wx.EVT_BUTTON, self.SeqParser )
        vbox.Add(button_view,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.SetAutoLayout(True)
        self.SetSizer( vbox )
        self.FitInside()
        self.SetScrollRate(5, 5)
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: promote.__init__
        kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.RESIZE_BORDER | wx.TAB_TRAVERSAL | wx.CLIP_CHILDREN
        wx.Dialog.__init__(self, *args, **kwds)
        self.panel_2 = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
        self.label_10 = wx.StaticText(self.panel_2, -1, "Current Class Details")
        self.combo_box_1 = wx.ComboBox(self.panel_2, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY)
        self.combo_box_2 = wx.ComboBox(self.panel_2, -1, choices=["Select Standard", "8", "9", "10"], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY)
        self.combo_box_3 = wx.ComboBox(self.panel_2, -1, choices=['Select Division'], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY)
        self.static_line_1 = wx.StaticLine(self.panel_2, -1, style=wx.LI_VERTICAL)
        self.label_11 = wx.StaticText(self.panel_2, -1, "Promote/Move To")
        self.combo_box_4 = wx.ComboBox(self.panel_2, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY)
        self.combo_box_5 = wx.ComboBox(self.panel_2, -1, choices=["Select Standard", "8", "9", "10"], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY)
        self.combo_box_6 = wx.ComboBox(self.panel_2, -1, choices=['Select Division'], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY)
        self.static_line_2 = wx.StaticLine(self.panel_2, -1)
        self.panel_1 = wx.Panel(self.panel_2, -1)
        allLoc = ['Admission No                       Name']
        self.check_list_box_1 = wx.CheckListBox(self.panel_1, -1, (60, 50), (30,30), allLoc)
        self.check_list_box_2 = wx.CheckListBox(self.panel_1, -1, (60, 50), wx.DefaultSize, [])

        #self.list_box_2 = wx.ListBox(self.panel_1, -1, choices=[])
        #self.list_box_3 = wx.ListBox(self.panel_1, -1, choices=[])

        self.button_cancel = wx.Button(self.panel_2, -1, "Close")
        self.button_proceed = wx.Button(self.panel_2, -1, "Proceed")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_COMBOBOX, self.oncombo_year1, self.combo_box_1)
        self.Bind(wx.EVT_COMBOBOX, self.oncombo_class1, self.combo_box_2)
        self.Bind(wx.EVT_COMBOBOX, self.oncombo_div1, self.combo_box_3)
        self.Bind(wx.EVT_COMBOBOX, self.oncombo_year2, self.combo_box_4)
        self.Bind(wx.EVT_COMBOBOX, self.oncombo_class2, self.combo_box_5)
        self.Bind(wx.EVT_COMBOBOX, self.oncombo_div2, self.combo_box_6)
        self.Bind(wx.EVT_CHECKLISTBOX, self.on_check, self.check_list_box_1)
        self.Bind(wx.EVT_CHECKLISTBOX, self.on_check_2, self.check_list_box_2)
        self.Bind(wx.EVT_BUTTON, self.on_cancel, self.button_cancel)
        self.Bind(wx.EVT_BUTTON, self.on_proceed, self.button_proceed)
        self.checkedItems=()
        self.DB=db_operations()
        self.load_year(self.combo_box_1 ,self.combo_box_2 ,self.combo_box_3 )
        self.load_year(self.combo_box_4 ,self.combo_box_5 ,self.combo_box_6 )
        # end wxGlade
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: add_div.__init__

        kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.STAY_ON_TOP
        wx.Dialog.__init__(self, *args, **kwds)
        self.panel_1 = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
        self.label_1 = wx.StaticText(self.panel_1, -1, "YEAR")


        self.combo_box_1 = wx.ComboBox(self.panel_1, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_DROPDOWN | wx.CB_READONLY | wx.CB_SORT)
        self.label_2 = wx.StaticText(self.panel_1, -1, "CLASS")
        self.combo_box_2 = wx.ComboBox(self.panel_1, -1, choices=["Select","8","9","10"], style=wx.CB_DROPDOWN | wx.CB_DROPDOWN | wx.CB_READONLY | wx.CB_SORT)
        self.sizer_4_staticbox = wx.StaticBox(self.panel_1, -1, "Specify Class ")
        self.list_box_1 = wx.ListBox(self.panel_1, -1, choices=[], style=wx.LB_SINGLE | wx.LB_SORT)
        self.button_1 = wx.Button(self.panel_1, -1, "Remove Divison")
        self.text_ctrl_1 = wx.TextCtrl(self.panel_1, -1, "")
        self.button_2 = wx.Button(self.panel_1, -1, "Add Division")
        self.sizer_9_staticbox = wx.StaticBox(self.panel_1, -1, "New Division")
        self.button_3 = wx.Button(self.panel_1, -1, "Close")
        self.hyperlink_1 = wx.HyperlinkCtrl(self.panel_1, wx.ID_ANY, "", "Add Academic Year")


        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_COMBOBOX, self.on_year, self.combo_box_1)
        self.Bind(wx.EVT_COMBOBOX, self.on_class, self.combo_box_2)
        self.Bind(wx.EVT_LISTBOX, self.on_list, self.list_box_1)
        self.Bind(wx.EVT_BUTTON, self.on_remove, self.button_1)
        self.Bind(wx.EVT_TEXT, self.on_text, self.text_ctrl_1)

        self.Bind(wx.EVT_BUTTON, self.on_add, self.button_2)
        self.Bind(wx.EVT_BUTTON, self.on_close, self.button_3)

        self.text_ctrl_1 .Bind(wx.EVT_SET_FOCUS,self.onfocus)
        self.text_ctrl_1 .Bind(wx.EVT_KILL_FOCUS,self.offocus)
        self.text_ctrl_1.Bind(wx.EVT_KEY_DOWN, self.on_keypress)

        self.Bind(wx.EVT_HYPERLINK, self.on_hlink, self.hyperlink_1)

        self.YEAR=''
        self.CLASS=''

        self.DB=db_operations()
        self.load_year()

        # end wxGlade
项目:LalkaChat    作者:DeForce    | 项目源码 | 文件源码
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)