def makeMournButton(text, width, height, location, click): button = Button() button.Text = text button.Width = width button.Height = height button.Location = location button.Click += click return button
def buttonbox(self): splitPadsize = 20 buttonHeight = 40 buttonwidth = 200 Width_pad = self.ClientSize.Width - splitPadsize * 2 - buttonwidth * 3 Width_pad /= 2 posx = Width_pad w = Button() w.Text = "刷新余额数据" w.Location = Point(posx, self.Posy) w.Height = buttonHeight w.Width = buttonwidth w.ForeColor = Color.Blue w.Click += self.刷新余额数据 w.Parent = self posx += buttonwidth + splitPadsize w1 = Button() w1.Text = "刷新筛选结果" w1.Location = Point(posx, self.Posy) w1.Height = buttonHeight w1.Width = buttonwidth w1.ForeColor = Color.Blue w1.Click += self.刷新筛选结果 w1.Parent = self posx += buttonwidth + splitPadsize w2 = Button() w2.Text = "退出系统" w2.Location = Point(posx, self.Posy) w2.Height = buttonHeight w2.Width = buttonwidth w2.ForeColor = Color.Blue w2.Click += self.退出系统 w2.Parent = self self.Posy += buttonHeight
def __init__(self): # Window Settings self.Text = 'Switch Generator' self.Width = 200 self.Height = 220 self.MinimizeBox = False self.MaximizeBox = False self.BackgroundColor = Color.Red self.FormBorderStyle = FormBorderStyle.FixedSingle self.ShowIcon = False self.label1 = Label() self.label1.Text = 'Input number:' self.label1.Location = Point(10, 0) self.tb = TextBox() self.tb.Text = "8" self.tb.Location = Point(10, 25) self.tb.Width = 160 self.label2 = Label() self.label2.Text = 'file name:' self.label2.Location = Point(10, 60) self.filepath = TextBox() self.filepath.Text = "c:/switch.cir" self.filepath.Location = Point(10, 85) self.filepath.Width = 160 button = Button() button.Text = 'Generate' button.Location = Point(10, 120) button.Width = 100 button.Height = 30 button.Click += self.button_click self.Controls.Add(self.label1) self.Controls.Add(self.tb) self.Controls.Add(self.label2) self.Controls.Add(self.filepath) self.Controls.Add(button)
def __init__(self): self.Text = "OpenDialog" self.Height = 140 self.Width = 376 self.MinimizeBox = False self.MaximizeBox = False self.CenterToScreen() self.label = Label() self.label.Text = "you can type *.png or *.jpg to find your purpose file, we put *.png for your help" self.label.Location = Point(0, 0) self.label.Height = 30 self.label.Width = 380 button = Button() button.Text = "Continue" button.Location = Point(0, 30) button.Height = 70 button.Width = 360 button.Click += self.buttonPressed self.Controls.Add(self.label) self.Controls.Add(button) self.Show() dialog = OpenFileDialog() dialog.Filter = "PNG or BMP or Tif files(*.png,*.bmp,*.tif)|*.png;*.tif;*.bmp" if dialog.ShowDialog(self) == DialogResult.OK: #data = dialog.FileNames f = open("Text/path.txt","w") f.write(dialog.FileName + "\n") f.close() else: f = open("Text/path.txt","w") f.write("cancel\n") f.close()
from System.Windows.Forms import Form, Button, Application from PythonSharp.Utilities import ObjectUtilities f = Form() f.Text = "PythonSharp Form" b = Button() b.Text = "Hello" b.Width = 150 b.Height = 50 f.Controls.Add(b) def click(sender, event): print("Click") ObjectUtilities.AddHandler(b, "Click", click, locals()) Application.Run(f)
tb.Width = inputwidth tb.Height = inputheight tb.Location = Point(xinput, y) form.Controls.Add(tb) form.Controls.Add(label) form.output.append(tb) elif j == 'bool': yn = CheckBox() yn.Location = Point(xinput, y) yn.Text = 'Yes/No' form.Controls.Add(yn) form.output.append(yn) elif j == 'fp': fp = Button() fp.Width = inputwidth fp.Height = inputheight fp.Text = 'FilePath' fp.Location = Point(xinput, y) form.Controls.Add(fp) fp.Click += form.openfile form.output.append(fp) elif j == 'dp': dp = Button() dp.Width = inputwidth dp.Height = inputheight dp.Text = 'DirectoryPath' dp.Location = Point(xinput, y) form.Controls.Add(dp) dp.Click += form.opendirectory form.output.append(dp) elif j == 'se':
a = Form() a.Text = "Hi" a.Name = "Hi" label = Label() label.Text = "lel" label.Location = Point(50, 50) label.Height = 30 label.Width = 200 a.Controls.Add(label) button = Button() button.Text = "yeman" button.Location = Point(100, 100) button.Height = 30 button.Width = 50 button.Click += clicked a.Controls.Add(button) Application.Run(a) # window = Tk() # window.title("Tagme") # window.geometry("500x500") # # # Top level frame, whole window # MAIN_FRAME = Frame(window) # MAIN_FRAME.pack(expand=1, fill=BOTH) # # # Next level frames, the search bar area and a frame below it for the rest of the window