Python wx 模块,ALIGN_TOP 实例源码

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

项目:Cognitive-Face-Python    作者:Microsoft    | 项目源码 | 文件源码
def OnDrawItem(self, dc, rect, index):
        """OnDrawItem for Layout."""
        face = self.faces[index]
        dc.DrawBitmap(face.bmp, rect.x + 2,
                      ((rect.height - face.bmp.GetHeight()) / 2) + rect.y)

        textx = rect.x + 2 + face.bmp.GetWidth() + 2
        label_rect = wx.Rect(textx, rect.y, rect.width - textx, rect.height)
        label = util.LABEL_FACE.format(
            face.attr.gender,
            face.attr.age,
            face.attr.hair,
            face.attr.facial_hair,
            face.attr.makeup,
            face.attr.emotion,
            face.attr.occlusion,
            face.attr.exposure,
            face.attr.head_pose,
            face.attr.accessories
        )
        dc.DrawLabel(label, label_rect, wx.ALIGN_LEFT | wx.ALIGN_TOP)
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(_LASSectionPanel, self).__init__(*args, **kwargs)

        vbox = wx.BoxSizer(wx.VERTICAL)
        add = wx.Button(self, -1, u'Adicionar linha', size=(100, -1))
        rem = wx.Button(self, -1, u'Remover linhas', size=(100, -1))
        self.Bind(wx.EVT_BUTTON, self.on_add, id=add.GetId())
        self.Bind(wx.EVT_BUTTON, self.on_remove, id=rem.GetId())
        vbox.Add(add, 1, wx.ALIGN_TOP)
        vbox.Add(rem, 1, wx.ALIGN_TOP)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.section_ctrl = _LASSectionCtrl(self)
        hbox.Add(vbox, 0)
        hbox.Add(self.section_ctrl, 1, wx.EXPAND)

        self.SetSizer(hbox)
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(_ODTSectionPanel, self).__init__(*args, **kwargs)

        vbox = wx.BoxSizer(wx.VERTICAL)
        add = wx.Button(self, -1, u'Adicionar linha', size=(100, -1))
        rem = wx.Button(self, -1, u'Remover linhas', size=(100, -1))
        self.Bind(wx.EVT_BUTTON, self.on_add, id=add.GetId())
        self.Bind(wx.EVT_BUTTON, self.on_remove, id=rem.GetId())
        vbox.Add(add, 1, wx.ALIGN_TOP)
        vbox.Add(rem, 1, wx.ALIGN_TOP)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.section_ctrl = _ODTSectionCtrl(self)
        hbox.Add(vbox, 0)
        hbox.Add(self.section_ctrl, 1, wx.EXPAND)

        self.SetSizer(hbox)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        CT.CustomTreeCtrl.__init__(self, *args, **kwargs)

        self.BackgroundBitmap = None
        self.BackgroundAlign = wx.ALIGN_LEFT | wx.ALIGN_TOP

        self.AddMenu = None
        self.Enabled = False

        self.Bind(wx.EVT_SCROLLWIN, self.OnScroll)
        self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
项目:bp5000    作者:isaiahr    | 项目源码 | 文件源码
def __init__(self, parent, match):
        self.match = match
        self.parent = parent
        wx.Dialog.__init__(self, parent)
        self.vsplit = wx.BoxSizer(wx.VERTICAL)
        self.ptop = wx.Panel(self)
        self.pbot = wx.Panel(self)
        pan = ScoresPanel(self.ptop, match, self)
        nw = wx.Button(self.pbot, label="no result", pos=(50, 15))
        rw = wx.Button(self.pbot, label="confirm", pos=(150, 15))
        self.vsplit.Add(self.ptop, 1, wx.ALIGN_TOP | wx.EXPAND)
        self.vsplit.Add(self.pbot, 1, wx.ALIGN_BOTTOM | wx.EXPAND)
        self.SetSizer(self.vsplit)

        def nowinner(e):
            self.match.settbd()
            self.parent.updatebracketimg()
            self.Close()

        def setwinner(e):
            self.match.setscore(pan.w1.GetValue(), pan.w2.GetValue())
            self.parent.updatebracketimg()
            self.Close()

        self.Bind(wx.EVT_BUTTON, nowinner, nw)
        self.Bind(wx.EVT_BUTTON, setwinner, rw)
        self.SetSize((300, 170))
        self.SetTitle("Report Scores")
        self.Show()
项目:bp5000    作者:isaiahr    | 项目源码 | 文件源码
def __init__(self, parent, match):
        self.match = match
        self.parent = parent
        wx.Dialog.__init__(self, parent)
        self.vsplit = wx.BoxSizer(wx.VERTICAL)
        self.ptop = wx.Panel(self)
        self.pbot = wx.Panel(self)
        pan = ScoresPanel(self.ptop, match, self)
        nw = wx.Button(self.pbot, label="no result", pos=(50, 15))
        rw = wx.Button(self.pbot, label="confirm", pos=(150, 15))
        self.vsplit.Add(self.ptop, 1, wx.ALIGN_TOP | wx.EXPAND)
        self.vsplit.Add(self.pbot, 1, wx.ALIGN_BOTTOM | wx.EXPAND)
        self.SetSizer(self.vsplit)

        def nowinner(e):
            self.match.settbd()
            self.parent.updatebracketimg()
            self.Close()

        def setwinner(e):
            if(self.match.doscore(pan.w1.GetValue(), pan.w2.GetValue())):
                self.parent.updatebracketimg()
                self.Close()
            else:
                pan.w1.SetValue(0)
                pan.w2.SetValue(0)

        self.Bind(wx.EVT_BUTTON, nowinner, nw)
        self.Bind(wx.EVT_BUTTON, setwinner, rw)
        self.SetSize((300, 170))
        self.SetTitle("Report Scores")
        self.Show()
项目:IntroPython2016a    作者:UWPCE-PythonCert    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        wx.Panel.__init__(self, *args, **kwargs)

        ## add a button:
        theButton1 = wx.Button(self, label="Push Me")
        theButton1.Bind(wx.EVT_BUTTON, self.onButton)

        ## add a static text lable:
        label1 = wx.StaticText(self, label="Input Box:")

        ## add a text control:
        self.inTextControl = wx.TextCtrl(self)

        ## add another button:
        theButton2 = wx.Button(self, label="GetData")
        theButton2.Bind(wx.EVT_BUTTON, self.onGetData)

        ## add a static text lable:
        label2 = wx.StaticText(self, label="Output Box:")
        ## and another text control:
        self.outTextControl = wx.TextCtrl(self, style=wx.TE_READONLY)


        ## do the layout
        buttonSizer = wx.BoxSizer(wx.VERTICAL)

        buttonSizer.Add(theButton1, 0, wx.GROW | wx.ALL, 4)
        buttonSizer.Add(label1, 0, wx.ALIGN_LEFT | wx.TOP, 4)
        buttonSizer.Add(self.inTextControl, 0, wx.GROW | wx.ALL, 4)
        buttonSizer.Add((150, 10))
        buttonSizer.Add(theButton2, 0, wx.GROW | wx.ALL, 4)
        buttonSizer.Add(label2, 0, wx.ALIGN_LEFT | wx.TOP, 4)
        buttonSizer.Add(self.outTextControl, 0, wx.GROW | wx.ALL, 4)

        ## need another sizer to get the horizonal placement right:
        mainSizer = wx.BoxSizer(wx.HORIZONTAL)
        mainSizer.Add((1,1), 1)    # stretchable space
        mainSizer.Add(buttonSizer, 0, wx.ALIGN_TOP) # the sizer with the buttons in it
        mainSizer.Add((1,1), 1)    # stretchable space

        self.SetSizer(mainSizer)
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def __init__(self, parent):
        super(DownloaderDialog, self).__init__(parent, title="pyjam Downloader",
                                               style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
        self.parent = parent

        self.audio_links = wx.TextCtrl(self)
        audio_link_text = wx.StaticText(self, label="URL(s) (Separate with commas)")

        self.out_dir = wx.DirPickerCtrl(self, path=os.path.abspath("downloads"))
        out_dir_text = wx.StaticText(self, label="Output directory")

        warning_text = wx.StaticText(self, style=wx.ALIGN_CENTRE_HORIZONTAL,
                                     label=("Note: The program will freeze for a bit while it processes the URL "
                                            "before downloading"))
        warning_text.Wrap(self.GetSize()[0])

        search_button = wx.Button(self, label="Search")

        top_sizer = wx.BoxSizer(wx.VERTICAL)
        control_sizer = wx.BoxSizer(wx.VERTICAL)
        text_sizer = wx.BoxSizer(wx.VERTICAL)
        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)

        control_sizer.Add(audio_link_text, 0, wx.ALL ^ wx.LEFT | wx.ALIGN_LEFT, 3)
        control_sizer.Add(self.audio_links, 0, wx.ALL ^ wx.LEFT ^ wx.TOP | wx.ALIGN_LEFT | wx.EXPAND, 5)
        control_sizer.Add(out_dir_text, 0, wx.ALL ^ wx.LEFT | wx.ALIGN_LEFT, 3)
        control_sizer.Add(self.out_dir, 0, wx.ALL ^ wx.LEFT ^ wx.TOP | wx.ALIGN_LEFT | wx.EXPAND, 5)
        text_sizer.Add(warning_text, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        button_sizer.Add(search_button)
        top_sizer.Add(control_sizer, 1, wx.ALL | wx.EXPAND | wx.ALIGN_TOP, 5)
        top_sizer.Add(text_sizer, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        top_sizer.Add(button_sizer, 0, wx.ALL | wx.ALIGN_CENTER, 5)

        self.Bind(wx.EVT_BUTTON, handler=self.on_ok, id=wx.ID_OK)
        self.Bind(wx.EVT_BUTTON, handler=lambda x: SearchDialog(self), source=search_button)

        self.downloader = None
        self.progress_dialog = None
        self.num_songs = 0

        self.SetSizerAndFit(top_sizer)
        self.Center()
        self.ShowModal()
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def __init__(self, parent):
        super(SearchDialog, self).__init__(parent=parent, title="pyjam Audio Search")
        self.parent = parent

        self.result_list = ObjectListView(parent=self, style=wx.LC_REPORT | wx.BORDER_SUNKEN, sortable=True,
                                          useAlternateBackColors=False)
        self.result_list.SetEmptyListMsg("No results")
        self.result_list.SetColumns([
            ColumnDefn(title="Title", valueGetter="title", width=150),
            ColumnDefn(title="Description", valueGetter="desc", width=300)
        ])

        self.search_recent = collections.deque([], 10)
        search_help = wx.StaticText(parent=self, label=("Enter a search term and press Enter. "
                                                        "Then, select the videos you want from the list and press OK."))
        self.search_query = wx.SearchCtrl(parent=self, style=wx.TE_PROCESS_ENTER)
        self.search_query.ShowCancelButton(True)
        self.search_query.SetMenu(self.search_menu())

        top_sizer = wx.BoxSizer(wx.VERTICAL)
        olv_sizer = wx.BoxSizer(wx.VERTICAL)
        query_sizer = wx.BoxSizer(wx.VERTICAL)

        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)

        olv_sizer.Add(self.result_list, 1, wx.LEFT | wx.RIGHT | wx.EXPAND | wx.ALIGN_TOP, 5)
        query_sizer.Add(search_help, 0, wx.ALL ^ wx.TOP, 5)
        query_sizer.Add(self.search_query, 0, wx.ALL ^ wx.TOP | wx.EXPAND, 5)
        top_sizer.Add(olv_sizer, 1, wx.ALL | wx.EXPAND, 5)
        top_sizer.Add(query_sizer, 0, wx.ALL | wx.EXPAND, 5)
        top_sizer.Add(button_sizer, 0, wx.ALL | wx.ALIGN_CENTER, 5)

        # Context menu
        self.context_menu = wx.Menu()
        open_url = self.context_menu.Append(wx.ID_OPEN, "Open link in browser")
        copy_url = self.context_menu.Append(wx.ID_COPY, "Copy link address")

        self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, handler=self.list_right_click, source=self.result_list)
        self.Bind(wx.EVT_MENU, handler=self.copy_url, source=copy_url)
        self.Bind(wx.EVT_MENU, handler=self.open_url, source=open_url)

        self.Bind(wx.EVT_TEXT_ENTER, handler=self.on_search, source=self.search_query)
        self.Bind(wx.EVT_BUTTON, handler=self.on_ok, id=wx.ID_OK)
        self.SetSizerAndFit(top_sizer)
        self.Center()
        self.ShowModal()
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def __init__(self, parent, rate=None, out_dir=None, in_dir=None):
        super(FFmpegConvertDialog, self).__init__(parent=parent, title="pyjam Audio Converter",
                                                  style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        self.in_dir = in_dir

        self.game_rate = intctrl.IntCtrl(self)
        game_rate_text = wx.StaticText(self, label="Audio rate")
        if rate is not None:
            self.game_rate.SetValue(rate)

        self.volume = wx.SpinCtrl(self, initial=85)
        volume_text = wx.StaticText(self, label="Volume %")

        self.in_picker = wx.FilePickerCtrl(self, style=wx.FLP_USE_TEXTCTRL)
        in_picker_text = wx.StaticText(self, label="Input file names (manually changing them has no effect)")
        self.in_files = []
        # the dumbest thing i've done all year (i'm overriding the controls of the PickerBase)
        for child in self.in_picker.GetChildren():
            if isinstance(child, wx.Button):
                child.Bind(wx.EVT_BUTTON, self.browse)

        self.out_dir = wx.DirPickerCtrl(self, name="Output directory")
        out_dir_text = wx.StaticText(self, label="Output directory")
        if out_dir is not None:
            self.out_dir.SetPath(out_dir)

        top_sizer = wx.BoxSizer(wx.VERTICAL)
        top_row = wx.BoxSizer(wx.HORIZONTAL)
        rate_sizer = wx.BoxSizer(wx.VERTICAL)
        vol_sizer = wx.BoxSizer(wx.VERTICAL)
        dir_sizer = wx.BoxSizer(wx.VERTICAL)
        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)

        rate_sizer.Add(game_rate_text, 0, wx.ALL ^ wx.BOTTOM | wx.ALIGN_LEFT, 5)
        rate_sizer.Add(self.game_rate, 0, wx.ALL | wx.ALIGN_LEFT, 5)
        vol_sizer.Add(volume_text, 0, wx.ALL ^ wx.BOTTOM | wx.ALIGN_LEFT, 5)
        vol_sizer.Add(self.volume, 0, wx.ALL | wx.ALIGN_LEFT, 5)
        top_row.Add(rate_sizer)
        top_row.Add(vol_sizer)
        dir_sizer.Add(in_picker_text, 0, wx.ALL ^ wx.LEFT | wx.ALIGN_LEFT, 3)
        dir_sizer.Add(self.in_picker, 0, wx.ALL ^ wx.LEFT ^ wx.TOP | wx.ALIGN_LEFT | wx.EXPAND, 5)
        dir_sizer.Add(out_dir_text, 0, wx.ALL ^ wx.LEFT | wx.ALIGN_LEFT, 3)
        dir_sizer.Add(self.out_dir, 0, wx.ALL ^ wx.LEFT ^ wx.TOP | wx.ALIGN_LEFT | wx.EXPAND, 5)
        top_sizer.Add(top_row)
        top_sizer.Add(dir_sizer, 1, wx.ALL | wx.EXPAND | wx.ALIGN_TOP, 5)
        top_sizer.Add(button_sizer, 0, wx.ALL | wx.ALIGN_CENTER, 5)

        self.Bind(wx.EVT_BUTTON, self.on_ok, id=wx.ID_OK)
        self.Bind(wx.EVT_BUTTON, self.on_cancel, id=wx.ID_CANCEL)

        self.converter = None
        self.progress_dialog = None
        self.num_songs = 0

        self.SetSizer(top_sizer)
        # self.SetSize(400, 250)
        self.Center()
        self.ShowModal()