def setup_post_panel(self): self.bottom_panel.Children.Clear() entry_pane = TextBox() entry_pane.AcceptsReturn = True entry_pane.Width = 275 entry_pane.Height = 75 entry_pane.FontSize = 14 entry_pane.Margin = Thickness(2) entry_pane.TextChanged += self.setCharsMsg entry_pane.TextWrapping = TextWrapping.Wrap self.entry_pane = entry_pane button = Button() button.Content = ' Post ' self.bottom_panel.Children.Add(entry_pane) self.bottom_panel.Children.Add(button) self.button = button button.Click += self.onPost button.Margin = Thickness(2) self.msg = TextBlock() self.msg.FontSize = 14 self.msg.HorizontalAlignment = HorizontalAlignment.Center self.msg.VerticalAlignment = VerticalAlignment.Center self.bottom_panel.Children.Add(self.msg) self.setCharsMsg(None, None)
def populate_login_panel(self): button = Button() button.Content = ' Login ' button.FontSize = 16 button.Margin = Thickness(5, 5, 5, 5) button.HorizontalAlignment = HorizontalAlignment.Stretch remember_me = CheckBox() remember_me.IsChecked = True remember_me.Margin = Thickness(5, 5, 5, 5) remember_me.Content = 'Remember' button_pane = StackPanel() button_pane.Children.Add(button) button_pane.Children.Add(remember_me) username = TextBox() username.FontSize = 16 username.Width = 200 username.Margin = Thickness(5, 5, 5, 5) password = PasswordBox() password.FontSize = 16 password.Width = 200 password.Margin = Thickness(5, 5, 5, 5) def HandleEnterKey(s, event): if event.Key == Key.Enter: event.Handled = True self.onLogin(None, None) password.KeyDown += HandleEnterKey if CheckStored(): stored_username, stored_password = GetStored() username.Text = stored_username password.Password = stored_password entry_panel = StackPanel() entry_panel.HorizontalAlignment = HorizontalAlignment.Stretch entry_panel.Children.Add(username) entry_panel.Children.Add(password) self.bottom_panel.Children.Add(entry_panel) self.bottom_panel.Children.Add(button_pane) self.button = button self.remember_me = remember_me self.username_box = username self.password_box = password button.Click += self.onLogin self.msg = TextBlock() self.msg.Text = ' Login ' self.msg.FontSize = 16 self.msg.HorizontalAlignment = HorizontalAlignment.Center self.msg.VerticalAlignment = VerticalAlignment.Center self.bottom_panel.Children.Add(self.msg)
textblock.Text = 'Stuff goes here' root.Children.Add(textblock) panel = StackPanel() panel.Margin = Thickness(20) panel.Orientation = Orientation.Horizontal button = Button() button.Content = 'Push Me' button.FontSize = 18 button.Margin = Thickness(10) textbox = TextBox() textbox.Text = "Type stuff here..." textbox.FontSize = 18 textbox.Margin = Thickness(10) textbox.Width = 200 #textbox.Watermark = 'Type Something Here' def onClick(s, e): textblock.Text = textbox.Text textbox.Text = "" def onKeyDown(sender, e): if e.Key == Key.Enter: e.Handled = True onClick(None, None) button.Click += onClick textbox.KeyDown += onKeyDown