Python wx.ALIGN_BOTTOM Examples
The following are 13
code examples of wx.ALIGN_BOTTOM().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: guiminer.py From poclbm with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, _("No OpenCL devices found.")) vbox = wx.BoxSizer(wx.VERTICAL) self.message = wx.StaticText(self, -1, _("""No OpenCL devices were found. If you only want to mine using CPU or CUDA, you can ignore this message. If you want to mine on ATI graphics cards, you may need to install the ATI Stream SDK, or your GPU may not support OpenCL.""")) vbox.Add(self.message, 0, wx.ALL, 10) hbox = wx.BoxSizer(wx.HORIZONTAL) self.no_show_chk = wx.CheckBox(self, -1) hbox.Add(self.no_show_chk) self.no_show_txt = wx.StaticText(self, -1, _("Don't show this message again")) hbox.Add((5, 0)) hbox.Add(self.no_show_txt) vbox.Add(hbox, 0, wx.ALL, 10) buttons = self.CreateButtonSizer(wx.OK) vbox.Add(buttons, 0, wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL, 0) self.SetSizerAndFit(vbox)
Example #2
Source File: FindWindow.py From EventGhost with GNU General Public License v2.0 | 6 votes |
def __init__(self, parent, hwnds): eg.Dialog.__init__( self, parent, title="Found Windows", size=(500, 350), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER, ) windowList = eg.WindowList(self, hwnds) okButton = wx.Button(self, wx.ID_OK) btnSizer = eg.HBoxSizer( ((0, 0), 1, wx.EXPAND), (okButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND | wx.ALL, 5), ((0, 0), 1, wx.EXPAND), (eg.SizeGrip(self), 0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT), ) mainSizer = eg.VBoxSizer( (windowList, 1, wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, 5), (btnSizer, 0, wx.EXPAND), ) self.SetSizer(mainSizer)
Example #3
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 6 votes |
def Configure(self, number="", msg="", service=""): panel = eg.ConfigPanel() label1Text = wx.StaticText(panel, -1, self.text.label1) label2Text = wx.StaticText(panel, -1, self.text.label2) label3Text = wx.StaticText(panel, -1, self.text.label3) textControl1 = wx.TextCtrl(panel, -1, number) textControl2 = wx.TextCtrl(panel, -1, msg) textControl3 = wx.TextCtrl(panel, -1, service) topSizer = wx.GridSizer(rows=2, cols=2) topSizer.Add(label1Text,0,wx.ALIGN_BOTTOM,0) topSizer.Add(label3Text,0,wx.ALIGN_BOTTOM,0) topSizer.Add(textControl1,0,wx.TOP,3) topSizer.Add(textControl3,0,wx.TOP,3) panel.sizer.Add(topSizer,0,wx.TOP|wx.EXPAND,0) panel.sizer.Add(label2Text,0,wx.TOP,10) panel.sizer.Add(textControl2,1,wx.EXPAND|wx.TOP,3) while panel.Affirmed(): panel.SetResult( textControl1.GetValue(), textControl2.GetValue(), textControl3.GetValue() )
Example #4
Source File: CustomTree.py From OpenPLC_Editor with GNU General Public License v3.0 | 6 votes |
def GetBitmapRect(self): client_size = self.GetClientSize() bitmap_size = self.BackgroundBitmap.GetSize() if self.BackgroundAlign & wx.ALIGN_RIGHT: x = client_size[0] - bitmap_size[0] elif self.BackgroundAlign & wx.ALIGN_CENTER_HORIZONTAL: x = (client_size[0] - bitmap_size[0]) // 2 else: x = 0 if self.BackgroundAlign & wx.ALIGN_BOTTOM: y = client_size[1] - bitmap_size[1] elif self.BackgroundAlign & wx.ALIGN_CENTER_VERTICAL: y = (client_size[1] - bitmap_size[1]) // 2 else: y = 0 return wx.Rect(x, y, bitmap_size[0], bitmap_size[1])
Example #5
Source File: guiminer.py From poclbm with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, id, title): wx.Dialog.__init__(self, parent, id, title) vbox = wx.BoxSizer(wx.VERTICAL) text = ABOUT_TEXT % dict(version=__version__, address=DONATION_ADDRESS) self.about_text = wx.StaticText(self, -1, text) self.copy_btn = wx.Button(self, -1, _("Copy address to clipboard")) vbox.Add(self.about_text) vbox.Add(self.copy_btn, 0, wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL, 0) self.SetSizerAndFit(vbox) self.copy_btn.Bind(wx.EVT_BUTTON, self.on_copy)
Example #6
Source File: commondialogs.py From CANFestivino with GNU Lesser General Public License v2.1 | 5 votes |
def _init_coll_MiddleGridSizer_Items(self, parent): parent.AddWindow(self.Select, 0, border=0, flag=wx.ALIGN_BOTTOM) parent.AddWindow(self.Unselect, 0, border=0, flag=wx.ALIGN_TOP)
Example #7
Source File: font_dialog.py From wxGlade with MIT License | 5 votes |
def __do_layout(self): sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_4 = wx.BoxSizer(wx.HORIZONTAL) sizer_5 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1_copy = wx.FlexGridSizer(2, 3, 2, 10) grid_sizer_2_copy = wx.FlexGridSizer(2, 3, 2, 5) grid_sizer_2_copy.Add(self.label_2_copy, 0, wx.ALIGN_BOTTOM, 3) grid_sizer_2_copy.Add(self.label_3_copy, 0, wx.ALIGN_BOTTOM, 3) grid_sizer_2_copy.Add(self.label_4_copy, 0, wx.ALIGN_BOTTOM, 3) grid_sizer_2_copy.Add(self.family, 0, wx.EXPAND, 0) grid_sizer_2_copy.Add(self.style, 0, wx.EXPAND, 0) grid_sizer_2_copy.Add(self.weight, 0, wx.EXPAND, 0) grid_sizer_2_copy.AddGrowableCol(0) grid_sizer_2_copy.AddGrowableCol(1) grid_sizer_2_copy.AddGrowableCol(2) sizer_5.Add(grid_sizer_2_copy, 0, wx.EXPAND, 0) grid_sizer_1_copy.Add(self.label_1, 0, wx.ALIGN_BOTTOM, 0) grid_sizer_1_copy.Add((20, 5), 0, wx.ALIGN_BOTTOM, 0) grid_sizer_1_copy.Add((20, 5), 0, wx.ALIGN_BOTTOM, 0) grid_sizer_1_copy.Add(self.point_size, 0, 0, 0) grid_sizer_1_copy.Add(self.underline, 0, wx.EXPAND, 0) grid_sizer_1_copy.Add(self.font_btn, 0, 0, 0) grid_sizer_1_copy.AddGrowableCol(1) sizer_5.Add(grid_sizer_1_copy, 0, wx.TOP|wx.EXPAND, 3) sizer_5.Add(self.static_line_1, 0, wx.TOP|wx.EXPAND, 8) sizer_2.Add(sizer_5, 0, wx.EXPAND, 0) sizer_4.Add(self.ok_btn, 0, wx.RIGHT, 12) sizer_4.Add(self.cancel_btn, 0, 0, 0) sizer_2.Add(sizer_4, 0, wx.TOP|wx.ALIGN_RIGHT, 9) sizer_1.Add(sizer_2, 1, wx.ALL|wx.EXPAND, 10) self.SetAutoLayout(1) self.SetSizer(sizer_1) sizer_1.Fit(self) sizer_1.SetSizeHints(self) self.Layout() self.CenterOnScreen()
Example #8
Source File: viewer_tools.py From dials with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, *args, **kwargs): kwargs["style"] = kwargs.get("style", 0) | wx.BORDER_NONE super(ImageChooserControl, self).__init__(*args, **kwargs) self._slider = wx.Slider(self, -1, style=wx.SL_AUTOTICKS) self._slider.SetMin(1) self._label = wx.StaticText(self, -1, "Some Text") # Work out the maximum size of the text so that we can cut off the slider to allow room if WX3: _, size_y = self._label.GetAdjustedBestSize() self._label.SetFont(self._label.GetFont().Italic()) self.size_y = max(size_y, self._label.GetAdjustedBestSize()[1]) else: _, size_y = self._label.GetEffectiveMinSize() self._label.SetFont(self._label.GetFont().Italic()) self.size_y = max(size_y, self._label.GetEffectiveMinSize()[1]) # Use a horizontal box to control vertical alignment labelSizer = wx.BoxSizer(wx.HORIZONTAL) labelSizer.Add(self._label, flag=wx.ALL | wx.ALIGN_BOTTOM) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self._slider, flag=wx.ALL | wx.ALIGN_LEFT) sizer.Add(labelSizer, proportion=1, flag=wx.EXPAND) self.SetSizer(sizer)
Example #9
Source File: mainframe.py From youtube-dl-gui with The Unlicense | 4 votes |
def _set_layout(self): """Sets the layout of the main window. """ main_sizer = wx.BoxSizer() panel_sizer = wx.BoxSizer(wx.VERTICAL) top_sizer = wx.BoxSizer(wx.HORIZONTAL) top_sizer.Add(self._url_text, 0, wx.ALIGN_BOTTOM | wx.BOTTOM, 5) top_sizer.AddSpacer((-1, -1), 1) top_sizer.Add(self._settings_button) panel_sizer.Add(top_sizer, 0, wx.EXPAND) panel_sizer.Add(self._url_list, 1, wx.EXPAND) mid_sizer = wx.BoxSizer(wx.HORIZONTAL) mid_sizer.Add(self._folder_icon) mid_sizer.AddSpacer((3, -1)) mid_sizer.Add(self._path_combobox, 2, wx.ALIGN_CENTER_VERTICAL) mid_sizer.AddSpacer((5, -1)) mid_sizer.Add(self._buttons["savepath"], flag=wx.ALIGN_CENTER_VERTICAL) mid_sizer.AddSpacer((10, -1), 1) mid_sizer.Add(self._videoformat_combobox, 1, wx.ALIGN_CENTER_VERTICAL) mid_sizer.AddSpacer((5, -1)) mid_sizer.Add(self._buttons["add"], flag=wx.ALIGN_CENTER_VERTICAL) panel_sizer.Add(mid_sizer, 0, wx.EXPAND | wx.ALL, 10) panel_sizer.Add(self._download_text, 0, wx.BOTTOM, 5) panel_sizer.Add(self._status_list, 2, wx.EXPAND) bottom_sizer = wx.BoxSizer(wx.HORIZONTAL) bottom_sizer.Add(self._buttons["delete"]) bottom_sizer.AddSpacer((5, -1)) bottom_sizer.Add(self._buttons["play"]) bottom_sizer.AddSpacer((5, -1)) bottom_sizer.Add(self._buttons["up"]) bottom_sizer.AddSpacer((5, -1)) bottom_sizer.Add(self._buttons["down"]) bottom_sizer.AddSpacer((5, -1)) bottom_sizer.Add(self._buttons["reload"]) bottom_sizer.AddSpacer((5, -1)) bottom_sizer.Add(self._buttons["pause"]) bottom_sizer.AddSpacer((10, -1), 1) bottom_sizer.Add(self._buttons["start"]) panel_sizer.Add(bottom_sizer, 0, wx.EXPAND | wx.TOP, 5) main_sizer.Add(panel_sizer, 1, wx.ALL | wx.EXPAND, 10) self._panel.SetSizer(main_sizer) self._panel.Layout()
Example #10
Source File: HeaderBox.py From EventGhost with GNU General Public License v2.0 | 4 votes |
def __init__(self, parent, name="", text="", icon=None, url = None): text = REPLACE_BR_TAG.sub('\n', text) text = REMOVE_HTML_PATTERN.sub('', text).strip() if text == name: text = "" self.parent = parent wx.PyWindow.__init__(self, parent, -1) self.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW) ) nameBox = wx.StaticText(self, -1, name) font = wx.Font(8, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD) nameBox.SetFont(font) self.text = '<html><body bgcolor="%s" text="%s">%s</body></html>' % ( self.GetBackgroundColour().GetAsString(wx.C2S_HTML_SYNTAX), self.GetForegroundColour().GetAsString(wx.C2S_HTML_SYNTAX), text ) if url: self.text = eg.Utils.AppUrl(self.text, url) descBox = eg.HtmlWindow(self, style=wx.html.HW_NO_SELECTION) descBox.SetBorders(1) descBox.SetFonts("Arial", "Times New Roman", [8, 8, 8, 8, 8, 8, 8]) descBox.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLinkClicked) self.descBox = descBox staticBitmap = wx.StaticBitmap(self) staticBitmap.SetIcon(icon.GetWxIcon()) mainSizer = eg.HBoxSizer( ((4, 4)), (staticBitmap, 0, wx.TOP, 5), ((4, 4)), (eg.VBoxSizer( ((4, 4)), (eg.HBoxSizer( (nameBox, 1, wx.EXPAND | wx.ALIGN_BOTTOM), ), 0, wx.EXPAND | wx.TOP, 2), (descBox, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 8), ), 1, wx.EXPAND), ) # odd sequence to setup the window, but all other ways seem # to wrap the text wrong self.SetSizer(mainSizer) self.SetAutoLayout(True) mainSizer.Fit(self) mainSizer.Layout() self.Layout() self.Bind(wx.EVT_SIZE, self.OnSize)
Example #11
Source File: AboutDialog.py From EventGhost with GNU General Public License v2.0 | 4 votes |
def Configure(self, parent): #IGNORE:W0221 if AboutDialog.instance: AboutDialog.instance.Raise() return AboutDialog.instance = self eg.TaskletDialog.__init__( self, parent=parent, title=Text.Title, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER ) notebook = wx.Notebook(self) notebook.AddPage(AboutPanel(notebook), Text.tabAbout) notebook.AddPage(SpecialThanksPanel(notebook), Text.tabSpecialThanks) notebook.AddPage(LicensePanel(notebook), Text.tabLicense) notebook.AddPage(SystemInfoPanel(notebook), Text.tabSystemInfo) notebook.AddPage(ChangelogPanel(notebook), Text.tabChangelog) def OnPageChanged(event): pageNum = event.GetSelection() notebook.ChangeSelection(pageNum) notebook.GetPage(pageNum).SetFocus() notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, OnPageChanged) okButton = wx.Button(self, wx.ID_OK, eg.text.General.ok) okButton.SetDefault() okButton.Bind(wx.EVT_BUTTON, self.OnOK) buttonSizer = eg.HBoxSizer( ((0, 0), 1, wx.EXPAND), (okButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND | wx.ALL, 5), ((0, 0), 1, wx.EXPAND), (eg.SizeGrip(self), 0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT), ) mainSizer = eg.VBoxSizer( (notebook, 1, wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, 5), (buttonSizer, 0, wx.EXPAND), ) self.SetSizerAndFit(mainSizer) self.SetMinSize(self.GetSize()) while self.Affirmed(): self.SetResult() AboutDialog.instance = None
Example #12
Source File: ArrayTypeDialog.py From OpenPLC_Editor with GNU General Public License v3.0 | 4 votes |
def __init__(self, parent, datatypes, infos): wx.Dialog.__init__(self, parent, title=_('Edit array type properties')) main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10) main_sizer.AddGrowableCol(0) main_sizer.AddGrowableRow(1) top_sizer = wx.BoxSizer(wx.HORIZONTAL) main_sizer.AddSizer(top_sizer, border=20, flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT) basetype_label = wx.StaticText(self, label=_('Base Type:')) top_sizer.AddWindow(basetype_label, 1, flag=wx.ALIGN_BOTTOM) self.BaseType = wx.ComboBox(self, style=wx.CB_READONLY) top_sizer.AddWindow(self.BaseType, 1, flag=wx.GROW) self.Dimensions = CustomEditableListBox(self, label=_("Dimensions:"), style=(wx.gizmos.EL_ALLOW_NEW | wx.gizmos.EL_ALLOW_EDIT | wx.gizmos.EL_ALLOW_DELETE)) for func in ["_OnLabelEndEdit", "_OnAddButton", "_OnDelButton", "_OnUpButton", "_OnDownButton"]: setattr(self.Dimensions, func, self.OnDimensionsChanged) main_sizer.AddSizer(self.Dimensions, border=20, flag=wx.GROW | wx.LEFT | wx.RIGHT) button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE) self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton()) main_sizer.AddSizer(button_sizer, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT) self.SetSizer(main_sizer) for datatype in datatypes: self.BaseType.Append(datatype) if isinstance(infos, tuple) and infos[0] == "array": self.BaseType.SetStringSelection(infos[1]) self.Dimensions.SetStrings(map("..".join, infos[2])) elif infos in datatypes: self.BaseType.SetStringSelection(infos) self.BaseType.SetFocus() self.Fit()
Example #13
Source File: ListCtrlPrinter.py From bookhub with MIT License | 4 votes |
def DrawText(self, dc, txt, bounds, font=None, alignment=wx.ALIGN_LEFT, valignment=wx.ALIGN_CENTRE, image=None, color=None, canWrap=True, imageIndex=-1, listCtrl=None): """ Draw the given text in the given DC according to the given characteristics. This is the workhorse text drawing method for our reporting engine. The *font*, *alignment*, and *color* attributes are applied to the drawn text. If *image* is not None, it will be drawn to the left of the text. All text is indented by the width of the image, even if the text is multi-line. If *imageIndex* is 0 or more and *listCtrl* is not None, the corresponding image from the ListCtrl's small image list will be drawn to the left of the text. If *canWrap* is True, the text will be wrapped to fit within the given bounds. If it is False, then the first line of *txt* will be truncated at the edge of the given *bounds*. """ GAP_BETWEEN_IMAGE_AND_TEXT = 4 def _CalcBitmapPosition(r, height): if valignment == wx.ALIGN_TOP: return RectUtils.Top(r) elif valignment == wx.ALIGN_CENTER: return RectUtils.CenterY(r) - height / 2 elif valignment == wx.ALIGN_BOTTOM: return RectUtils.Bottom(r) - height else: return RectUtils.Top(r) # Draw any image if image: y = _CalcBitmapPosition(bounds, image.Height) dc.DrawBitmap(image, RectUtils.Left(bounds), y) RectUtils.MoveLeftBy(bounds, image.GetWidth()+GAP_BETWEEN_IMAGE_AND_TEXT) elif listCtrl and imageIndex >=0: imageList = listCtrl.GetImageList(wx.IMAGE_LIST_SMALL) y = _CalcBitmapPosition(bounds, imageList.GetSize(0)[1]) imageList.Draw(imageIndex, dc, RectUtils.Left(bounds), y, wx.IMAGELIST_DRAW_TRANSPARENT) RectUtils.MoveLeftBy(bounds, imageList.GetSize(0)[0]+GAP_BETWEEN_IMAGE_AND_TEXT) # Draw the text dc.SetFont(font or self.GetFont()) dc.SetTextForeground(color or self.GetTextColor() or wx.BLACK) if canWrap: WordWrapRenderer.DrawString(dc, txt, bounds, alignment, valignment) else: WordWrapRenderer.DrawTruncatedString(dc, txt, bounds, alignment, valignment)