class WebBrowserSample(Form): """WebBrowser control class""" def __init__(self): """WebBrowserSample class init function.""" # setup title self.Text = "WebBrowser control" self.Width = 800 self.Height = 600 url = 'http://mono-project.com/Accessibility' # setup webbrowser self.webbrowser = WebBrowser() self.webbrowser.Navigate(url) self.webbrowser.Dock = DockStyle.Fill self.webbrowser.Navigated += self.navigated # setup Location bar self.location = TextBox() self.location.Text = url self.location.Dock = DockStyle.Top self.location.KeyPress += self.key_press # add controls self.Controls.Add(self.webbrowser) self.Controls.Add(self.location) def key_press(self, sender, event): if event.KeyChar == u'\r': self.webbrowser.Navigate(self.location.Text.strip()) def navigated(self, sender, event): self.location.Text = event.Url.ToString()
def LocateYTID(): """Function to find YouTube Channel ID!""" f = Form() f.Text = "YouTube Advanced Account Settings" f.Width = 630 f.Height = 630 wb = WebBrowser() wb.ScriptErrorsSuppressed = True wb.Navigate("https://www.youtube.com/account_advanced") wb.Dock = DockStyle.Fill f.Controls.Add(wb) f.ShowDialog()
def init(self): self.browser = WebBrowser() self.browser.Url = Uri(self.url) self.browser.StatusTextChanged += self.on_statustext_changed self.browser.Dock = DockStyle.Fill self.status_strip = StatusStrip() self.status = ToolStripStatusLabel() self.status_strip.Items.Add(self.status) self.Controls.Add(self.browser) self.Controls.Add(self.status_strip)
def __init__(self): """WebBrowserSample class init function.""" # setup title self.Text = "WebBrowser control" self.Width = 800 self.Height = 600 url = 'http://mono-project.com/Accessibility' # setup webbrowser self.webbrowser = WebBrowser() self.webbrowser.Navigate(url) self.webbrowser.Dock = DockStyle.Fill self.webbrowser.Navigated += self.navigated # setup Location bar self.location = TextBox() self.location.Text = url self.location.Dock = DockStyle.Top self.location.KeyPress += self.key_press # add controls self.Controls.Add(self.webbrowser) self.Controls.Add(self.location)
def init(self): """Initialize the form. Returns ------- None """ self.browser = WebBrowser() self.browser.Url = self.url self.browser.StatusTextChanged += self.on_statustext_changed self.browser.Dock = DockStyle.Fill self.status_strip = StatusStrip() self.status = ToolStripStatusLabel() self.status_strip.Items.Add(self.status) self.Controls.Add(self.browser) self.Controls.Add(self.status_strip)