def __init__(self, itemlist): height = len(itemlist) * 17 self.Text = "Select the categories to export" self.Size = Size(300, height + 80) self.check = CheckedListBox() self.check.Parent = self self.check.Location = Point(5, 5) self.check.Size = Size(270, height) # load the list of relevant categories found in the project list_items = List[Object](itemlist) self.check.Items.AddRange(list_items.ToArray()) self.check.CheckOnClick = True # set checked by default for i in range(len(itemlist)): self.check.SetItemChecked(i, True) okay = Button() okay.Parent = self okay.Text = 'OK' okay.Location = Point(50, height + 10) okay.Width = 140 okay.Click += self.onValidate cancel = Button() cancel.Parent = self cancel.Text = 'Cancel' cancel.Location = Point(okay.Right, height + 10) cancel.Click += self.onCancel self.CenterToScreen()
def __init__(self, itemlist): height = len(itemlist)*17 self.Text = "Select the categories to export" self.Size = Size(300, height + 80) self.check = CheckedListBox() self.check.Parent = self self.check.Location = Point(5, 5) self.check.Size = Size(270, height) # load the list of relevant categories found in the project list_items = List[Object](itemlist) self.check.Items.AddRange(list_items.ToArray()) self.check.CheckOnClick = True # set checked by default for i in range(len(itemlist)): self.check.SetItemChecked(i , True) okay = Button() okay.Parent = self okay.Text = 'OK' okay.Location = Point(50, height+10) okay.Width = 140 okay.Click += self.onValidate cancel = Button() cancel.Parent = self cancel.Text = 'Cancel' cancel.Location = Point(okay.Right, height+10) cancel.Click += self.onCancel self.CenterToScreen()
def __init__(self): self.m_testport = 'COM3' #: Port on test system self.m_test_meter = "300001162" #: Test V4 meter ekm_set_log(ekm_print_log) print "\n****\nInitializing v3 and v4 for db test" self.Text = 'Sample EKM Iron Python App' self.label = Label() self.label.Text = "0.0" self.label.Location = Point(50, 50) self.label.Height = 30 self.label.Width = 200 self.count = 0 button = Button() button.Text = "Read Meter: " + self.m_test_meter button.Location = Point(50, 100) button.Width = 180 button.Click += self.buttonPressed self.Controls.Add(self.label) self.Controls.Add(button)
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 setupOKButtons(self): self.OKbuttonPanel = self.miniPanel(0, 950) printButton = Button() printButton.Text = "Imprimer" printButton.Location = Point(25, 28) #self.AcceptButton = okButton printButton.Click += self.printClicked #cancelButton = Button() #cancelButton.Text = "Annuler" #cancelButton.Location = Point(110,10) #self.CancelButton = cancelButton #cancelButton.Click += self.cancelClicked levelwindowButton = Button() levelwindowButton.Text = "Level/Window" levelwindowButton.Location = Point(25, 28) levelwindowButton.Width = 85 levelwindowButton.Click += self.levelwindowClicked referencedoseButton = Button() referencedoseButton.Text = "Toggle Reference Dose" referencedoseButton.Location = Point(117, 28) referencedoseButton.Width = 140 referencedoseButton.Click += self.referencedoseClicked nbfxButton = Button() nbfxButton.Text = "Nb. de fx" nbfxButton.Location = Point(263, 28) nbfxButton.Width = 70 nbfxButton.Click += self.nbfxClicked self.message = Label() self.message.Text = "" self.message.Location = Point(30, 0) self.message.Font = Font("Arial", 11, FontStyle.Bold) self.message.AutoSize = True #Printing has been disabled for verif 1, simply add the printButton back if you want to reactivate it self.OKbuttonPanel.Controls.Add(nbfxButton) self.OKbuttonPanel.Controls.Add(levelwindowButton) self.OKbuttonPanel.Controls.Add(referencedoseButton) self.OKbuttonPanel.Controls.Add(self.message)
def setupOKButtons(self): self.OKbuttonPanel = self.miniPanel(0, 900) printButton = Button() printButton.Text = "Imprimer" printButton.Location = Point(25, 28) #self.AcceptButton = okButton printButton.Click += self.printClicked #cancelButton = Button() #cancelButton.Text = "Annuler" #cancelButton.Location = Point(110,10) #self.CancelButton = cancelButton #cancelButton.Click += self.cancelClicked levelwindowButton = Button() levelwindowButton.Text = "Level/Window" levelwindowButton.Location = Point(108, 28) levelwindowButton.Width = 85 levelwindowButton.Click += self.levelwindowClicked referencedoseButton = Button() referencedoseButton.Text = "Toggle Reference Dose" referencedoseButton.Location = Point(200, 28) referencedoseButton.Width = 140 referencedoseButton.Click += self.referencedoseClicked nbfxButton = Button() nbfxButton.Text = "Nb. de fx" nbfxButton.Location = Point(345, 28) nbfxButton.Width = 70 nbfxButton.Click += self.nbfxClicked self.message = Label() self.message.Text = "" self.message.Location = Point(30, 0) self.message.Font = Font("Arial", 11, FontStyle.Bold) self.message.AutoSize = True self.OKbuttonPanel.Controls.Add(printButton) self.OKbuttonPanel.Controls.Add(levelwindowButton) self.OKbuttonPanel.Controls.Add(referencedoseButton) self.OKbuttonPanel.Controls.Add(nbfxButton) self.OKbuttonPanel.Controls.Add(self.message)
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 showBox(self): ''' set the remaining box controls and launch ''' self.buttonpanel = Panel() self.buttonpanel.Parent = self self.buttonpanel.Location = Point(0, self.panel.Bottom) self.buttonpanel.Size = Size(Fconfig.smwidth, 2 * Fconfig.unitline) self.buttonpanel.Dock = DockStyle.Bottom self.warning = Label() self.warning.Parent = self.buttonpanel self.warning.Location = Point(Fconfig.margin, 0) self.warning.Size = Size(Fconfig.smwidth, Fconfig.unitline) self.warning.Font = Font(Fconfig.basefont, Fconfig.sizefont, FontStyle.Bold) self.warning.ForeColor = Color.Coral self.warning.TextAlign = ContentAlignment.MiddleCenter okay = Button() okay.Parent = self.buttonpanel okay.Text = Fconfig.buttonOK okay.Location = Point(50, Fconfig.unitline) okay.Width = 140 okay.Click += self.onValidate okay.Anchor = AnchorStyles.Right cancel = Button() cancel.Text = Fconfig.buttonCANCEL cancel.Parent = self.buttonpanel cancel.Location = Point(okay.Right, Fconfig.unitline) cancel.Click += self.onCancel cancel.Anchor = AnchorStyles.Right self.Width = Fconfig.width self.Height = self.panel.Bottom + 105 self.CenterToScreen() ModeDBG.say('\npanel top :{0}, bottom :{1}'.format( self.panel.Top, self.panel.Bottom)) ModeDBG.say('\n\nPanel loaded with {0} items\n'.format( len(self.panelparams))) # Display the form try: if Application.MessageLoop: TaskDialog.Show('UserForm', 'Another window is running...') else: Application.Run(self) except: TaskDialog.Show('UserForm', 'Loading failed...')
def showBox(self): ''' set the remaining box controls and launch ''' self.buttonpanel = Panel() self.buttonpanel.Parent = self self.buttonpanel.Location = Point(0,self.panel.Bottom) self.buttonpanel.Size = Size(Fconfig.smwidth, 2* Fconfig.unitline) self.buttonpanel.Dock = DockStyle.Bottom self.warning = Label() self.warning.Parent = self.buttonpanel self.warning.Location = Point(Fconfig.margin, 0) self.warning.Size = Size(Fconfig.smwidth, Fconfig.unitline) self.warning.Font = Font(Fconfig.basefont, Fconfig.sizefont, FontStyle.Bold) self.warning.ForeColor = Color.Coral self.warning.TextAlign = ContentAlignment.MiddleCenter okay = Button() okay.Parent = self.buttonpanel okay.Text = Fconfig.buttonOK okay.Location = Point(50, Fconfig.unitline) okay.Width = 140 okay.Click += self.onValidate okay.Anchor = AnchorStyles.Right cancel = Button() cancel.Text = Fconfig.buttonCANCEL cancel.Parent = self.buttonpanel cancel.Location = Point(okay.Right, Fconfig.unitline) cancel.Click += self.onCancel cancel.Anchor = AnchorStyles.Right self.Width = Fconfig.width self.Height = self.panel.Bottom + 105 self.CenterToScreen() ModeDBG.say('\npanel top :{0}, bottom :{1}'.format( self.panel.Top, self.panel.Bottom)) ModeDBG.say('\n\nPanel loaded with {0} items\n'.format( len(self.panelparams))) # Display the form try: if Application.MessageLoop: TaskDialog.Show('UserForm', 'Another window is running...') else: Application.Run(self) except: TaskDialog.Show('UserForm','Loading failed...')
def initialiseButtons(self): buttonPanel = Panel() buttonPanel.Height = 23 buttonPanel.Dock = DockStyle.Bottom buttonPanel.Width = 170 acceptButton = Button() acceptButton.Text = "OK" acceptButton.DialogResult = DialogResult.OK acceptButton.Width = 75 acceptButton.Dock = DockStyle.Left self.AcceptButton = acceptButton buttonPanel.Controls.Add(acceptButton) cancelButton = Button() cancelButton.Text = "Cancel" cancelButton.DialogResult = DialogResult.Cancel cancelButton.Width = 75 cancelButton.Dock = DockStyle.Right self.CancelButton = cancelButton buttonPanel.Controls.Add(cancelButton) self.Controls.Add(buttonPanel)
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.Text = 'Default' 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)
def setupMainWindow(self): self.MainWindow = self.Panel(0, 60) vert_spacer = 30 offset = 50 self.toplabel = Label() self.toplabel.Text = "PTV Dose (Gy)" self.toplabel.Font = Font("Arial", 10, FontStyle.Bold) self.toplabel.Location = Point(60, 20) self.toplabel.AutoSize = True self.PTV1combo = ComboBox() self.PTV1combo.Parent = self self.PTV1combo.Size = Size(120,40) self.PTV1combo.Location = Point(25, offset) self.PTV1combo.Text = "Choisissez ROI" self.dose1_value = TextBox() self.dose1_value.Text = "" self.dose1_value.Location = Point(180, offset) self.dose1_value.Width = 50 self.PTV2combo = ComboBox() self.PTV2combo.Parent = self self.PTV2combo.Size = Size(120,40) self.PTV2combo.Location = Point(25, offset + vert_spacer) self.PTV2combo.Text = "Choisissez ROI" self.dose2_value = TextBox() self.dose2_value.Text = "" self.dose2_value.Location = Point(180, offset + vert_spacer) self.dose2_value.Width = 50 self.PTV3combo = ComboBox() self.PTV3combo.Parent = self self.PTV3combo.Size = Size(120,40) self.PTV3combo.Location = Point(25, offset + 2*vert_spacer) self.PTV3combo.Text = "Choisissez ROI" self.dose3_value = TextBox() self.dose3_value.Text = "" self.dose3_value.Location = Point(180, offset + 2*vert_spacer) self.dose3_value.Width = 50 self.fxlabel = Label() self.fxlabel.Text = "Nb de fx" self.fxlabel.Location = Point(25, offset + 3.5*vert_spacer) self.fxlabel.Font = Font("Arial", 10, FontStyle.Bold) self.fxlabel.AutoSize = True self.fxbox = TextBox() self.fxbox.Parent = self self.fxbox.Size = Size(50,40) self.fxbox.Location = Point(150, offset + 3.5*vert_spacer) self.fxbox.Text = "1" self.techlabel = Label() self.techlabel.Text = "Technique" self.techlabel.Location = Point(25, offset + 4.5*vert_spacer) self.techlabel.Font = Font("Arial", 10, FontStyle.Bold) self.techlabel.AutoSize = True self.techcombo = ComboBox() self.techcombo.Parent = self self.techcombo.Size = Size(90,40) self.techcombo.Location = Point(150, offset + 4.5*vert_spacer) self.techcombo.Text = "VMAT" self.techcombo.Items.Add('VMAT') self.techcombo.Items.Add('IMRT') self.techcombo.Items.Add('3DC') self.sitelabel = Label() self.sitelabel.Text = "Nom du site" self.sitelabel.Location = Point(25, offset + 5.5*vert_spacer) self.sitelabel.Font = Font("Arial", 10, FontStyle.Bold) self.sitelabel.AutoSize = True self.sitebox = TextBox() self.sitebox.Parent = self self.sitebox.Size = Size(50,40) self.sitebox.Location = Point(150, offset + 5.5*vert_spacer) self.sitebox.Text = "A1" self.isolabel = Label() self.isolabel.Text = "Isocentre" self.isolabel.Location = Point(25, offset + 6.5*vert_spacer) self.isolabel.Font = Font("Arial", 10, FontStyle.Bold) self.isolabel.AutoSize = True self.isocombo = ComboBox() self.isocombo.Parent = self self.isocombo.Size = Size(90,40) self.isocombo.Location = Point(150, offset + 6.5*vert_spacer) for poi in patient.PatientModel.PointsOfInterest: self.isocombo.Items.Add(poi.Name) if poi.Name == 'ISO': self.isocombo.Text = 'ISO' elif self.isocombo.Text != 'ISO' and poi.Name == 'REF SCAN': self.isocombo.Text = 'REF SCAN' self.scanlabel = Label() self.scanlabel.Text = "CT de planif" self.scanlabel.Location = Point(25, offset + 7.5*vert_spacer) self.scanlabel.Font = Font("Arial", 10, FontStyle.Bold) self.scanlabel.AutoSize = True self.scancombo = ComboBox() self.scancombo.Parent = self self.scancombo.Size = Size(90,40) self.scancombo.Location = Point(150, offset + 7.5*vert_spacer) for ct in patient.Examinations: self.scancombo.Items.Add(ct.Name) if ct.Name == 'CT 1': self.scancombo.Text = 'CT 1' self.machinelabel = Label() self.machinelabel.Text = "Appareil" self.machinelabel.Location = Point(25, offset + 8.5*vert_spacer) self.machinelabel.Font = Font("Arial", 10, FontStyle.Bold) self.machinelabel.AutoSize = True self.machinecombo = ComboBox() self.machinecombo.Parent = self self.machinecombo.Size = Size(90,40) self.machinecombo.Location = Point(150, offset + 8.5*vert_spacer) self.machinecombo.Text = "BeamMod" self.machinecombo.Items.Add('BeamMod') self.machinecombo.Items.Add('Infinity') self.isodoselabel = Label() self.isodoselabel.Text = "Dose table" self.isodoselabel.Location = Point(25, offset + 9.5*vert_spacer) self.isodoselabel.Font = Font("Arial", 10, FontStyle.Bold) self.isodoselabel.AutoSize = True self.isodosecombo = ComboBox() self.isodosecombo.Parent = self self.isodosecombo.Size = Size(90,40) self.isodosecombo.Location = Point(150, offset + 9.5*vert_spacer) self.isodosecombo.Text = "Créer" self.isodosecombo.Items.Add('Créer') self.isodosecombo.Items.Add('Ne pas créer') self.couchlabel = Label() self.couchlabel.Text = "Couch table" self.couchlabel.Location = Point(25, offset + 10.5*vert_spacer) self.couchlabel.Font = Font("Arial", 10, FontStyle.Bold) self.couchlabel.AutoSize = True self.couchcombo = ComboBox() self.couchcombo.Parent = self self.couchcombo.Size = Size(90,40) self.couchcombo.Location = Point(150, offset + 10.5*vert_spacer) self.couchcombo.Text = "Ne pas ajouter" self.couchcombo.Items.Add('Ne pas ajouter') #self.couchcombo.Items.Add('Ajouter') self.message = Label() self.message.Text = "Sélectionnez le(s) ROI(s) à traiter (chaque\ncontour distinct devrait être indiqué\nséparément). Seulement les ROIs avec\nPTV dans leurs noms sont disponibles.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nLes plans IMRT/3DC avec plusieurs PTVs\ndistincts auront une optimisation automatique\ndu collimateur. SVP ne touchez pas à\nl'ordinateur pendant cette optimisation\n(4 à 5 minutes environ)" self.message.Location = Point(300, offset) self.message.Font = Font("Arial", 11, FontStyle.Italic) self.message.AutoSize = True self.status = Label() self.status.Text = "" self.status.Location = Point(25, 760) self.status.Font = Font("Arial", 11, FontStyle.Bold) self.status.AutoSize = True self.OARlabel = Label() self.OARlabel.Text = "Max doses custom (Gy)" self.OARlabel.Location = Point(25, offset + 13*vert_spacer) self.OARlabel.Font = Font("Arial", 10, FontStyle.Bold) self.OARlabel.AutoSize = True self.OAR1combo = ComboBox() self.OAR1combo.Parent = self self.OAR1combo.Size = Size(120,40) self.OAR1combo.Location = Point(25, offset + 14*vert_spacer) self.OAR1combo.Text = "Choisissez OAR" self.OAR1_value = TextBox() self.OAR1_value.Text = "" self.OAR1_value.Location = Point(160, offset + 14*vert_spacer) self.OAR1_value.Width = 50 self.OAR2combo = ComboBox() self.OAR2combo.Parent = self self.OAR2combo.Size = Size(120,40) self.OAR2combo.Location = Point(25, offset + 15*vert_spacer) self.OAR2combo.Text = "Choisissez OAR" self.OAR2_value = TextBox() self.OAR2_value.Text = "" self.OAR2_value.Location = Point(160, offset + 15*vert_spacer) self.OAR2_value.Width = 50 self.OAR3combo = ComboBox() self.OAR3combo.Parent = self self.OAR3combo.Size = Size(120,40) self.OAR3combo.Location = Point(25, offset + 16*vert_spacer) self.OAR3combo.Text = "Choisissez OAR" self.OAR3_value = TextBox() self.OAR3_value.Text = "" self.OAR3_value.Location = Point(160, offset + 16*vert_spacer) self.OAR3_value.Width = 50 evalButton = Button() evalButton.Text = "Évaluer les PTVs" evalButton.Location = Point(25, offset + 18 * vert_spacer) evalButton.Width = 200 evalButton.Click += self.evalClicked addplanButton = Button() addplanButton.Text = "Ajouter plan" addplanButton.Location = Point(25, offset + 19 * vert_spacer) addplanButton.Width = 200 addplanButton.Click += self.addplanClicked self.stepcombo = ComboBox() self.stepcombo.Parent = self self.stepcombo.Size = Size(250,40) self.stepcombo.Location = Point(25, offset + 20 * vert_spacer) self.stepcombo.Text = "Rouler le script au complet" self.stepcombo.Items.Add('Rouler le script au complet') self.stepcombo.Items.Add('Multi-PTV: Arrêtez avant optimization collimateur') self.stepcombo.Items.Add('Multi-PTV: Reprendre après optimization collimateur') eraseROIButton = Button() eraseROIButton.Text = "Effacer les ROIs de prédiction" eraseROIButton.Location = Point(25, offset + 21.5 * vert_spacer) eraseROIButton.Width = 200 eraseROIButton.Click += self.eraseROIClicked self.MainWindow.Controls.Add(self.toplabel) self.MainWindow.Controls.Add(self.PTV1combo) self.MainWindow.Controls.Add(self.dose1_value) self.MainWindow.Controls.Add(self.PTV2combo) self.MainWindow.Controls.Add(self.dose2_value) self.MainWindow.Controls.Add(self.PTV3combo) self.MainWindow.Controls.Add(self.dose3_value) self.MainWindow.Controls.Add(self.fxlabel) self.MainWindow.Controls.Add(self.fxbox) self.MainWindow.Controls.Add(self.techlabel) self.MainWindow.Controls.Add(self.techcombo) self.MainWindow.Controls.Add(self.sitelabel) self.MainWindow.Controls.Add(self.sitebox) self.MainWindow.Controls.Add(self.isolabel) self.MainWindow.Controls.Add(self.isocombo) self.MainWindow.Controls.Add(self.scanlabel) self.MainWindow.Controls.Add(self.scancombo) self.MainWindow.Controls.Add(self.machinelabel) self.MainWindow.Controls.Add(self.machinecombo) self.MainWindow.Controls.Add(self.isodoselabel) self.MainWindow.Controls.Add(self.isodosecombo) self.MainWindow.Controls.Add(self.couchlabel) self.MainWindow.Controls.Add(self.couchcombo) self.MainWindow.Controls.Add(self.OARlabel) self.MainWindow.Controls.Add(self.OAR1combo) self.MainWindow.Controls.Add(self.OAR1_value) self.MainWindow.Controls.Add(self.OAR2combo) self.MainWindow.Controls.Add(self.OAR2_value) self.MainWindow.Controls.Add(self.OAR3combo) self.MainWindow.Controls.Add(self.OAR3_value) self.MainWindow.Controls.Add(self.message) self.MainWindow.Controls.Add(self.status) self.MainWindow.Controls.Add(evalButton) self.MainWindow.Controls.Add(addplanButton) self.MainWindow.Controls.Add(self.stepcombo) self.MainWindow.Controls.Add(eraseROIButton) #Label empty contours exam_list = [] for CT in patient.Examinations: exam_list.append(CT.Name) for contour in patient.PatientModel.RegionsOfInterest: VolCT1 = roi.get_roi_volume(contour.Name, exam=patient.Examinations["CT 1"]) if "CT 2" in exam_list: VolCT2 = roi.get_roi_volume(contour.Name, exam=patient.Examinations["CT 2"]) else: VolCT2 = 0 if VolCT1 == 0 and VolCT2 == 0: contour.Name = ("vide_" + contour.Name)
def setupMainWindow(self): self.MainWindow = self.Panel(0, 60) vert_spacer = 32 offset = 15 self.label_billes = Label() self.label_billes.Text = "Billes sur point de localisation" self.label_billes.Location = Point(15, offset) self.label_billes.Font = Font("Arial", 10.25, FontStyle.Bold) self.label_billes.AutoSize = True self.check_billes = CheckBox() self.check_billes.Location = Point(410, offset - 2) self.check_billes.Width = 30 self.check_billes.Checked = False button_ext = Button() button_ext.Text = "Contour 'External' et overrides" button_ext.Font = Font("Arial", 10.25, FontStyle.Bold) button_ext.Location = Point(15, offset + vert_spacer) button_ext.Width = 375 button_ext.Click += self.button_ext_Clicked self.check_ext = CheckBox() self.check_ext.Location = Point(410, offset + vert_spacer - 2) self.check_ext.Width = 30 self.check_ext.Checked = False button_isoOK = Button() button_isoOK.Text = "Position de l'isocentre et point de localisation" button_isoOK.Font = Font("Arial", 10.25, FontStyle.Bold) button_isoOK.Location = Point(15, offset + vert_spacer * 2) button_isoOK.Width = 375 button_isoOK.Click += self.button_isoOK_Clicked self.check_isoOK = CheckBox() self.check_isoOK.Location = Point(410, offset + vert_spacer * 2 - 2) self.check_isoOK.Width = 30 self.check_isoOK.Checked = False button_segments = Button() button_segments.Text = "Les segments sont corrects/flashé au besoin" button_segments.Font = Font("Arial", 10.25, FontStyle.Bold) button_segments.Location = Point(15, offset + vert_spacer * 3) button_segments.Width = 375 button_segments.Click += self.button_segments_Clicked self.check_segments = CheckBox() self.check_segments.Location = Point(410, offset + vert_spacer * 3 - 2) self.check_segments.Width = 30 self.check_segments.Checked = False button_beams_Rx = Button() button_beams_Rx.Text = "Faisceaux et prescription" button_beams_Rx.Font = Font("Arial", 10.25, FontStyle.Bold) button_beams_Rx.Location = Point(15, offset + vert_spacer * 4) button_beams_Rx.Width = 375 button_beams_Rx.Click += self.button_beams_Clicked self.check_beams_Rx = CheckBox() self.check_beams_Rx.Location = Point(410, offset + vert_spacer * 4 - 2) self.check_beams_Rx.Width = 30 self.check_beams_Rx.Checked = False button_grid = Button() button_grid.Text = "La grille de dose est correcte" button_grid.Font = Font("Arial", 10.25, FontStyle.Bold) button_grid.Location = Point(15, offset + vert_spacer * 5) button_grid.Width = 375 button_grid.Click += self.button_grid_Clicked self.check_grid = CheckBox() self.check_grid.Location = Point(410, offset + vert_spacer * 5 - 2) self.check_grid.Width = 30 self.check_grid.Checked = False self.label_distribution_dose = Label() self.label_distribution_dose.Text = "Distribution de dose et clinical goals" self.label_distribution_dose.Location = Point( 15, offset + vert_spacer * 6) self.label_distribution_dose.Font = Font("Arial", 10.25, FontStyle.Bold) self.label_distribution_dose.AutoSize = True self.check_distribution_dose = CheckBox() self.check_distribution_dose.Location = Point( 410, offset + vert_spacer * 6 - 2) self.check_distribution_dose.Width = 30 self.check_distribution_dose.Checked = False self.label_noteMD = Label() self.label_noteMD.Text = "Vérif note de planif du MD NON" self.label_noteMD.Location = Point(15, offset + vert_spacer * 7) self.label_noteMD.Font = Font("Arial", 10.25, FontStyle.Bold) self.label_noteMD.AutoSize = True self.check_noteMD_non = CheckBox() self.check_noteMD_non.Location = Point( 340, offset + vert_spacer * 7 - 2) self.check_noteMD_non.Width = 30 self.check_noteMD_non.Checked = False self.label_OK1 = Label() self.label_OK1.Text = "OK" self.label_OK1.Location = Point(370, offset + vert_spacer * 7) self.label_OK1.Font = Font("Arial", 10.25, FontStyle.Bold) self.label_OK1.AutoSize = True self.check_noteMD_OK = CheckBox() self.check_noteMD_OK.Location = Point(410, offset + vert_spacer * 7 - 2) self.check_noteMD_OK.Width = 30 self.check_noteMD_OK.Checked = False self.label_DSP = Label() self.label_DSP.Text = "Vérif note positionnement: HT, DSPs, matching" self.label_DSP.Location = Point(15, offset + vert_spacer * 8) self.label_DSP.Font = Font("Arial", 10.25, FontStyle.Bold) self.label_DSP.AutoSize = True self.check_DSP = CheckBox() self.check_DSP.Location = Point(410, offset + vert_spacer * 8 - 2) self.check_DSP.Width = 30 self.check_DSP.Checked = False self.label_mise_en_place = Label() self.label_mise_en_place.Text = "Vérif mise en place: ISO DICOM, struct, phase" self.label_mise_en_place.Location = Point(15, offset + vert_spacer * 9) self.label_mise_en_place.Font = Font("Arial", 10.25, FontStyle.Bold) self.label_mise_en_place.AutoSize = True self.check_mise_en_place = CheckBox() self.check_mise_en_place.Location = Point( 410, offset + vert_spacer * 9 - 2) self.check_mise_en_place.Width = 30 self.check_mise_en_place.Checked = False self.label_doctx = Label() self.label_doctx.Text = "Vérification Document de Tx NON" self.label_doctx.Location = Point(15, offset + vert_spacer * 10) self.label_doctx.Font = Font("Arial", 10.25, FontStyle.Bold) self.label_doctx.AutoSize = True self.check_doctx_non = CheckBox() self.check_doctx_non.Location = Point( 340, offset + vert_spacer * 10 - 2) self.check_doctx_non.Width = 30 self.check_doctx_non.Checked = False self.label_OK2 = Label() self.label_OK2.Text = "OK" self.label_OK2.Location = Point(370, offset + vert_spacer * 10) self.label_OK2.Font = Font("Arial", 10.25, FontStyle.Bold) self.label_OK2.AutoSize = True self.check_doctx_OK = CheckBox() self.check_doctx_OK.Location = Point(410, offset + vert_spacer * 10 - 2) self.check_doctx_OK.Width = 30 self.check_doctx_OK.Checked = False self.label_codestat = Label() self.label_codestat.Text = "Vérification des codes statistiques" self.label_codestat.Location = Point(15, offset + vert_spacer * 11) self.label_codestat.Font = Font("Arial", 10.25, FontStyle.Bold) self.label_codestat.AutoSize = True self.check_codestat = CheckBox() self.check_codestat.Location = Point(410, offset + vert_spacer * 11 - 2) self.check_codestat.Width = 30 self.check_codestat.Checked = False #Count up beamsets bs_text = "" num_bs = 0 for bs in plan.BeamSets: bs_text += bs.DicomPlanLabel + ", " num_bs += 1 self.label_results_header = Label() self.label_results_header.Text = "Résultats" self.label_results_header.Location = Point( 15, offset + vert_spacer * 12.5) self.label_results_header.Font = Font("Arial", 11, FontStyle.Bold) self.label_results_header.AutoSize = True self.label_results = Label() self.label_results.Text = "Nombre de beamsets dans le plan: " + str( num_bs) + ' (' + bs_text[0:-2] + ')' self.label_results.Location = Point(15, offset + vert_spacer * 13.5) self.label_results.Font = Font( "Arial", 10, ) self.label_results.AutoSize = True self.label_reminder = Label() self.label_reminder.Text = "Rappel:\nRoulez le script de vérification pour chaque beamset" self.label_reminder.Location = Point(15, offset + vert_spacer * 14.5) self.label_reminder.Font = Font("Arial", 10.25, FontStyle.Bold) self.label_reminder.ForeColor = Color.Red self.label_reminder.AutoSize = True self.MainWindow.Controls.Add(self.label_billes) self.MainWindow.Controls.Add(self.check_billes) self.MainWindow.Controls.Add(button_ext) self.MainWindow.Controls.Add(self.check_ext) self.MainWindow.Controls.Add(button_isoOK) self.MainWindow.Controls.Add(self.check_isoOK) self.MainWindow.Controls.Add(button_segments) self.MainWindow.Controls.Add(self.check_segments) self.MainWindow.Controls.Add(button_beams_Rx) self.MainWindow.Controls.Add(self.check_beams_Rx) self.MainWindow.Controls.Add(button_grid) self.MainWindow.Controls.Add(self.check_grid) self.MainWindow.Controls.Add(self.label_distribution_dose) self.MainWindow.Controls.Add(self.check_distribution_dose) self.MainWindow.Controls.Add(self.label_noteMD) self.MainWindow.Controls.Add(self.check_noteMD_non) self.MainWindow.Controls.Add(self.label_OK1) self.MainWindow.Controls.Add(self.check_noteMD_OK) self.MainWindow.Controls.Add(self.label_DSP) self.MainWindow.Controls.Add(self.check_DSP) self.MainWindow.Controls.Add(self.label_mise_en_place) self.MainWindow.Controls.Add(self.check_mise_en_place) self.MainWindow.Controls.Add(self.label_doctx) self.MainWindow.Controls.Add(self.check_doctx_non) self.MainWindow.Controls.Add(self.label_OK2) self.MainWindow.Controls.Add(self.check_doctx_OK) self.MainWindow.Controls.Add(self.label_codestat) self.MainWindow.Controls.Add(self.check_codestat) self.MainWindow.Controls.Add(self.label_results_header) self.MainWindow.Controls.Add(self.label_results) self.MainWindow.Controls.Add(self.label_reminder)
def setupMainWindow(self): self.MainWindow = self.Panel(0, 60) vert_spacer = 35 offset = 20 self.label_bonscan = Label() self.label_bonscan.Text = "Le bon scan est utilisé pour la planification" self.label_bonscan.Location = Point(15, offset) self.label_bonscan.Font = Font("Arial", 10.25, FontStyle.Bold) self.label_bonscan.AutoSize = True self.check_bonscan = CheckBox() self.check_bonscan.Location = Point(410, offset - 2) self.check_bonscan.Width = 30 self.check_bonscan.Checked = False self.label_scanOK = Label() self.label_scanOK.Text = "Scan OK (artéfactes, étendu du scan, objets sur la table)" self.label_scanOK.Location = Point(15, offset + vert_spacer) self.label_scanOK.Font = Font("Arial", 10.25, FontStyle.Bold) self.label_scanOK.AutoSize = True self.check_scanOK = CheckBox() self.check_scanOK.Location = Point(410, offset + vert_spacer - 2) self.check_scanOK.Width = 30 self.check_scanOK.Checked = False button_ext = Button() button_ext.Text = "Contour 'External' + overrides" button_ext.Font = Font("Arial", 10.25, FontStyle.Bold) button_ext.Location = Point(15, offset + vert_spacer * 2) button_ext.Width = 375 button_ext.Click += self.button_ext_Clicked self.check_ext = CheckBox() self.check_ext.Location = Point(410, offset + vert_spacer * 2 - 2) self.check_ext.Width = 30 self.check_ext.Checked = False self.label_contours = Label() self.label_contours.Text = "Les contours d'optimisation sont corrects" self.label_contours.Location = Point(15, offset + vert_spacer * 3) self.label_contours.Font = Font("Arial", 10.25, FontStyle.Bold) self.label_contours.AutoSize = True self.check_contours = CheckBox() self.check_contours.Location = Point(410, offset + vert_spacer * 3 - 2) self.check_contours.Width = 30 self.check_contours.Checked = False button_isoOK = Button() button_isoOK.Text = "Position de l'isocentre" button_isoOK.Font = Font("Arial", 10.25, FontStyle.Bold) button_isoOK.Location = Point(15, offset + vert_spacer * 4) button_isoOK.Width = 375 button_isoOK.Click += self.button_isoOK_Clicked self.check_isoOK = CheckBox() self.check_isoOK.Location = Point(410, offset + vert_spacer * 4 - 2) self.check_isoOK.Width = 30 self.check_isoOK.Checked = False button_beams_Rx = Button() button_beams_Rx.Text = "Faisceaux et prescription" button_beams_Rx.Font = Font("Arial", 10.25, FontStyle.Bold) button_beams_Rx.Location = Point(15, offset + vert_spacer * 5) button_beams_Rx.Width = 375 button_beams_Rx.Click += self.button_beams_Clicked self.check_beams_Rx = CheckBox() self.check_beams_Rx.Location = Point(410, offset + vert_spacer * 5 - 2) self.check_beams_Rx.Width = 30 self.check_beams_Rx.Checked = False button_optimisation = Button() button_optimisation.Text = "Objectifs et paramètres d'optimisation" button_optimisation.Font = Font("Arial", 10.25, FontStyle.Bold) #button_optimisation.TextAlign = HorizontalAlignment.Center button_optimisation.Location = Point(15, offset + vert_spacer * 6) button_optimisation.Width = 375 button_optimisation.Click += self.button_opt_Clicked self.check_optimisation = CheckBox() self.check_optimisation.Location = Point( 410, offset + vert_spacer * 6 - 2) self.check_optimisation.Width = 30 self.check_optimisation.Checked = False self.label_distribution_dose = Label() self.label_distribution_dose.Text = "Distribution de dose et clinical goals" self.label_distribution_dose.Location = Point( 15, offset + vert_spacer * 7) self.label_distribution_dose.Font = Font("Arial", 10.25, FontStyle.Bold) self.label_distribution_dose.AutoSize = True self.check_distribution_dose = CheckBox() self.check_distribution_dose.Location = Point( 410, offset + vert_spacer * 7 - 2) self.check_distribution_dose.Width = 30 self.check_distribution_dose.Checked = False #Count up beamsets bs_text = "" num_bs = 0 for bs in plan.BeamSets: bs_text += bs.DicomPlanLabel + ", " num_bs += 1 self.label_results_header = Label() self.label_results_header.Text = "Résultats" self.label_results_header.Location = Point( 15, offset + vert_spacer * 9) self.label_results_header.Font = Font("Arial", 11, FontStyle.Bold) self.label_results_header.AutoSize = True self.label_results = Label() self.label_results.Text = "Nombre de beamsets dans le plan: " + str( num_bs) + ' (' + bs_text[0:-2] + ')' self.label_results.Location = Point(15, offset + vert_spacer * 10) self.label_results.Font = Font( "Arial", 10, ) self.label_results.AutoSize = True self.label_reminder = Label() self.label_reminder.Text = "Rappel:\nRoulez le script de vérification pour chaque beamset" self.label_reminder.Location = Point(15, offset + vert_spacer * 11) self.label_reminder.Font = Font("Arial", 10.25, FontStyle.Bold) self.label_reminder.ForeColor = Color.Red self.label_reminder.AutoSize = True self.MainWindow.Controls.Add(self.label_bonscan) self.MainWindow.Controls.Add(self.check_bonscan) self.MainWindow.Controls.Add(self.label_scanOK) self.MainWindow.Controls.Add(self.check_scanOK) self.MainWindow.Controls.Add(button_ext) self.MainWindow.Controls.Add(self.check_ext) self.MainWindow.Controls.Add(button_isoOK) self.MainWindow.Controls.Add(self.check_isoOK) self.MainWindow.Controls.Add(button_beams_Rx) self.MainWindow.Controls.Add(self.check_beams_Rx) self.MainWindow.Controls.Add(self.label_contours) self.MainWindow.Controls.Add(self.check_contours) self.MainWindow.Controls.Add(button_optimisation) self.MainWindow.Controls.Add(self.check_optimisation) self.MainWindow.Controls.Add(self.label_distribution_dose) self.MainWindow.Controls.Add(self.check_distribution_dose) self.MainWindow.Controls.Add(self.label_results_header) self.MainWindow.Controls.Add(self.label_results) self.MainWindow.Controls.Add(self.label_reminder)
def __init__(self): FORMheight = 250 FORMwidth = 400 self.Text = 'Whatsapp Import - Whatsapp messages loader' self.Height = FORMheight-50 self.Width = FORMwidth flowPanel = FlowLayoutPanel() flowPanel.AutoSize = True flowPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink self.Controls.Add(flowPanel) labelDir = Label() labelDir.Text = "Exported artifacts directory path:" labelDir.Top = 20 labelDir.Left = 10 labelDir.Width = 300 labelDir.Anchor = AnchorStyles.Top TextboxDir = TextBox() TextboxDir.Name = 'ImportDir' TextboxDir.Text = '\export'#[type directory]' TextboxDir.Top = 45 TextboxDir.Left = 10 TextboxDir.Width = 360 TextboxDir.Anchor = AnchorStyles.Top '''labelRegex = Label() labelRegex.Text = "Chat file's name regex:" labelRegex.Top = 75 labelRegex.Left = 10 labelRegex.Width = 300 labelRegex.Anchor = AnchorStyles.Top fileRegex = TextBox() fileRegex.Name = 'fileNameRegex' fileRegex.Text = '^Conversa\sdo\sWhatsApp\scom\s(.*)\.txt$' fileRegex.Top = 100 fileRegex.Left = 10 fileRegex.Width = 360 fileRegex.Anchor = AnchorStyles.Top''' '''SelectDirBtn = Button() SelectDirBtn.Text = 'Select dir.' SelectDirBtn.Width = 150 SelectDirBtn.Top = 80 SelectDirBtn.Left = 350 SelectDirBtn.UseVisualStyleBackColor = True SelectDirBtn.Anchor = AnchorStyles.Top SelectDirBtn.Click += self.onClick''' button = Button() button.Text = "Import" button.Width = 110 button.Top = 120 button.Left = (FORMwidth / 2) - 50 button.Anchor = AnchorStyles.Top button.Click += self.buttonPressed self.Controls.Add(labelDir) self.Controls.Add(TextboxDir) #self.Controls.Add(labelRegex) #self.Controls.Add(fileRegex) #self.Controls.Add(SelectDirBtn) self.Controls.Add(button)
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 # LOAD_ROW = LabelFrame(MAIN_FRAME, height=20)