def __init__(self, message: str, label: str = None, url: str = None, **kwargs) -> None: super(HyperlinkDialog, self).__init__(parent=None, **kwargs) pane = self.GetContentsPane() text_ctrl = StaticText(pane, label=message) text_ctrl.SetFocus() text_ctrl.SetSizerProps(align="center") if url is not None: if label is None: label = url hyperlink = HyperlinkCtrl(pane, label=label, url=url) hyperlink.Bind(EVT_HYPERLINK, self.on_hyperlink) button_ok = Button(pane, label="OK") button_ok.Bind(EVT_BUTTON, self.on_ok) button_ok.SetSizerProps(align="center", border=(["top"], 10)) self.SetIcon( Icon(ArtProvider.GetBitmap(ART_INFORMATION, ART_MESSAGE_BOX))) self.Fit() self.Centre()
def create_syntax_colorization_help(self): if self._syntax_colorization_help_exists: return label = Label( self, label="Syntax colorization disabled due to missing requirements.") link = HyperlinkCtrl(self, -1, label="Get help", url="") link.Bind(EVT_HYPERLINK, self.show_help_dialog) flags = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT syntax_colorization_help_sizer = wx.BoxSizer(wx.VERTICAL) syntax_colorization_help_sizer.AddMany([(label, 0, flags), (link, 0, flags)]) self.editor_toolbar.add_expanding(syntax_colorization_help_sizer) self.Layout() self._syntax_colorization_help_exists = True