def MenuItem_Click(self, sender, e): gs = GameSetting() gs.ShowDialog() if gs.DialogResult == True: MessageBox.Show("Game Start") else: MessageBox.Show("Cancel")
def button_Click(self, sender, e): x = self.textboxNama.Text.ToString() if x == "" or self.ComboBoxJk.Text == "" or ( self.mkn.IsChecked == False and self.tdr.IsChecked == False and self.jln.IsChecked == False): MessageBox.Show("Belum Diisi") else: #menentukan Gender if self.ComboBoxJk.Text == self.ComboBoxJk.Items.GetItemAt( 0).ToString(): gender = "Mas" # MessageBox.Show("Halo Mas "+x+ " yang suka") elif self.ComboBoxJk.Text == self.ComboBoxJk.Items.GetItemAt( 1).ToString(): gender = "mbak" # MessageBox.Show("Halo Mbak ") #menentukan Hobi if self.mkn.IsChecked: hobi = "Makan" elif self.tdr.IsChecked: hobi = "Tidur" elif self.jln.IsChecked: hobi = "Jalan-Jalan" MessageBox.Show("Halo " + gender + " " + x + " yang hobinya " + hobi) pass pass
def GoAutoMesh(sender, args): file_path = os.path.dirname(os.path.realpath(__file__)) dictionary["RefineDiameter"] = refineDiamInput.Text dictionary["FineMeshSize"] = meshRefinementInput.Text dictionary["CoarseMeshSize"] = meshCoarseInput.Text dictionary["FileList"] = "" dictionary["ExtendBead"] = True if not selectedFiles: ans = MessageBox.Show("Please import trajectories first", "Error") elif refineDiamInput.Text == "": ans = MessageBox.Show("Please specify the refinement diameter first", "Error") elif meshRefinementInput.Text == "": ans = MessageBox.Show("Please specify the refinement mesh size first", "Error") elif meshCoarseInput.Text == "": ans = MessageBox.Show("Please specify the coarse mesh size first", "Error") else: for elem in selectedFiles: dictionary["FileList"] += elem dictionary["FileList"] += ',' apex_sdk.runScriptFunction(file=os.path.join(file_path, 'Automesh.py'), function="ArcWeldAutomesh", args=dictionary)
def bw_RunWorkerCompleted(self, sender, e): self.statusTextBlock.Text = "" self.progressBar.Value = 0 if (e.Cancelled == True): MessageBox.Show("処理を中断しました。") else: MessageBox.Show("処理が終了しました。" + e.Result.ToString()) self.startButton.IsEnabled = True self.stopButton.IsEnabled = False
def excluir(self, sender, e): index = self.lvProdutos.SelectedIndex if (index == -1): MessageBox.Show('Selecione um produto!') elif (MessageBox.Show('Realmente deseja remover este produto?', '', MessageBoxButton.YesNo) == MessageBoxResult.Yes): del self.lvProdutos.ItemsSource[index] self.lvProdutos.Items.Refresh() self.id = None itens = self.lvProdutos.Items self.editar_arquivo(self.NOME_ARQUIVO, self.WRITE, itens) self.listar() pass
def button_Click(self, sender, e): if self.combo1.Text == "" or self.combo2.Text == "": MessageBox.Show("Belum Diisi") else: if self.combo1.Text == self.combo1.Items.GetItemAt(0).ToString(): x = 'a' elif self.combo1.Text == self.combo1.Items.GetItemAt(1).ToString(): x = 'b' elif self.combo1.Text == self.combo1.Items.GetItemAt(2).ToString(): x = 'c' elif self.combo1.Text == self.combo1.Items.GetItemAt(3).ToString(): x = 'd' elif self.combo1.Text == self.combo1.Items.GetItemAt(4).ToString(): x = 'e' elif self.combo1.Text == self.combo1.Items.GetItemAt(5).ToString(): x = 'f' elif self.combo1.Text == self.combo1.Items.GetItemAt(6).ToString(): x = 'g' elif self.combo2.Text == self.combo2.Items.GetItemAt(0).ToString(): y = 'a' elif self.combo2.Text == self.combo2.Items.GetItemAt(1).ToString(): y = 'b' elif self.combo2.Text == self.combo2.Items.GetItemAt(2).ToString(): y = 'c' elif self.combo2.Text == self.combo2.Items.GetItemAt(3).ToString(): y = 'd' elif self.combo2.Text == self.combo2.Items.GetItemAt(4).ToString(): y = 'e' elif self.combo2.Text == self.combo2.Items.GetItemAt(5).ToString(): y = 'f' elif self.combo2.Text == self.combo2.Items.GetItemAt(6).ToString(): y = 'g' alg(graph, x, y) pass
def Button1_Click(self, sender, e): try: angle = float(self.RotateAngle.Text) Transfer.rotate(angle) except ValueError: MessageBox.Show("Input invalid") self.RotateAngle.Clear()
def coupon_Click(self, sender, e): MessageBox.Show( "Daftar Coupon Hari ini : \n" + "WFH2020 : Cashback 100% dengan Maksimal Cashback Rp 20.000 \n" + "RAMADHAN : Cashback 20% dengan Maksimal Cashback Rp 50.000 \n" + "DIRUMAH : Cashback 75% dengan Maksimal Cashback Rp 75.000") pass
def EzYesNoCancelDialog(message, title, icon=System.Windows.MessageBoxImage.Information): rv = MessageBox.Show(message, title, MessageBoxButton.YesNoCancel, icon) if rv == MessageBoxResult.Yes: return True elif rv == MessageBoxResult.No: return False else: return None
def _timer_Tick(self, sender, e): ''' keeps running to get the command and control. event is the signal from Xbox controller ''' #Transfer.check()\ #print("for/bavk/stop:{0}{1}{2}".format(Transfer.rx.Status.IsMovingForward, Transfer.rx.Status.IsMovingBackward, Transfer.rx.Status.IsMoving)) events = get_events() for event in events: if event.type == EVENT_BUTTON_RELEASED and event.button == "BACK": Transfer.close() if event.type == EVENT_BUTTON_RELEASED and event.button == "START": Transfer.__init__() #self.__init__() !!!! if event.type == EVENT_BUTTON_PRESSED and event.button == "LEFT_SHOULDER": if self.Mode.Text == "Low speed mode": Transfer.setspeed([200000, 500000, 25000, 300000]) self.Mode.Text = "High speed mode" else: Transfer.setspeed([20000, 20000, 2500, 5000]) self.Mode.Text = "Low speed mode" print(Transfer.speed) WrongInfo = Transfer.move(event) if WrongInfo != 'None': MessageBox.Show(WrongInfo)
def paket_Click(self, sender, e): paketan = [10000, 20000, 50000, 100000, 250000, 500000, 1000000] harga = [] if self.ComboBoxD.Text == "": MessageBox.Show( "Mohon Pilih distributor yang ingin di cek harga paketannya") else: if self.ComboBoxD.Text == self.ComboBoxD.Items.GetItemAt( 0).ToString(): distri = "Garena" t = 2000 k = 1 elif self.ComboBoxD.Text == self.ComboBoxD.Items.GetItemAt( 1).ToString(): distri = "Origin" t = 1000 k = 1.5 elif self.ComboBoxD.Text == self.ComboBoxD.Items.GetItemAt( 2).ToString(): distri = "Gamescool" t = 0 k = 1 elif self.ComboBoxD.Text == self.ComboBoxD.Items.GetItemAt( 3).ToString(): distri = "Steam Wallet" t = 0 k = 1.5 elif self.ComboBoxD.Text == self.ComboBoxD.Items.GetItemAt( 4).ToString(): distri = "Epic Games" t = 2000 k = 1.5 for x in paketan: y = x * k + t harga.append(y) MessageBox.Show("Paketan Untuk Distributor " + distri + ":" + "\n Rp 10.000 = Rp " + str(harga[0]) + "\n Rp 20.000 = Rp " + str(harga[1]) + "\n Rp 50.000 = Rp " + str(harga[2]) + "\n Rp 100.000 = Rp " + str(harga[3]) + "\n Rp 250.000 = Rp " + str(harga[4]) + "\n Rp 500.000 = Rp " + str(harga[5]) + "\n Rp 1.000.000 = Rp " + str(harga[6])) pass
def editar(self, sender, e): index = self.lvProdutos.SelectedIndex if (index > -1): produto = self.lvProdutos.ItemsSource[index] self.id = index self.preencherCampos(produto) else: MessageBox.Show('Selecione um produto!') pass
def btnOK_Click(self, sender, e): tW = False tH = False if tW and tH: MessageBox.Show("Please enter the value") else: self.DialogResult = True self.Close()
def editar(self, sender, e): index = self.lvPessoas.SelectedIndex if (index > -1): pessoa = self.lvPessoas.ItemsSource[index] self.id = index self.preencherCampos(pessoa) else: MessageBox.Show('Selecione uma pessoa!') pass
def SK_Click(self, sender, e): MessageBox.Show( "Syarat dan Ketentuan berbelanja di SMAM SHOP \n" + "1.Setiap Transaksi yang telah di checkout harus segera di bayar maksimal 7x24 jam \n" + "2.Pengembalian uang hanya dilayani 7x24 jam setelah kode dikirimkan \m" + "3.Kesalahan Penulisan ID tidak menjadi tanggung jawab kami \n" + "4.Diharapkan untuk tidak spam ke email\n\n" + "CS : [email protected]") pass
def on_loaded(self, s, e): self.nui = Runtime() if not self.nui: MessageBox.Show( "Runtime initialization failed. Please make sure Kinect device is plugged in." ) return self.nui.Initialize(RuntimeOptions.UseSkeletalTracking) self.nui.SkeletonFrameReady += self.nui_skeleton_frame_ready
def button_Click(self, sender, e): x = self.textboxNama.Text.ToString() y = self.textboxEmail.Text.ToString() z = self.textboxSaldo.Text.ToString() a = int(z) if x == "" or y == "" or self.ComboBoxJk.Text == "" or ( self.low.IsChecked == False and self.medium.IsChecked == False and self.high.IsChecked == False): MessageBox.Show("Mohon Data Datanya Dilengkapi") else: if self.ComboBoxJk.Text == self.ComboBoxJk.Items.GetItemAt( 0).ToString(): gender = "Bapak" elif self.ComboBoxJk.Text == self.ComboBoxJk.Items.GetItemAt( 1).ToString(): gender = "Ibu" if self.low.IsChecked: tabungan = "Reguler" bunga = "5%" elif self.medium.IsChecked: tabungan = "Gold" bunga = "10%" elif self.high.IsChecked: tabungan = "Platinum" bunga = "20%" if a < 100000: MessageBox.Show("Saldo Tidak Mencukupi") pass else: MessageBox.Show( "Terima Kasih " + gender + " " + x + ", Anda telah Membuka Tabungan " + tabungan + " Dengan bunga per bulan " + bunga + ".\n\nEmail Verivikasi telah dikirimkan ke : " + y + "\n Saldo Awal anda adalah : " + z) pass pass pass
def Submit_Button_Click(self, sender, e): try: client = MainClient() client.UserID = self.InputuserID.Text client.PSW = self.Inputpassw.Password ss = client.conn() if client.result == 'Y': Choose = Window1(ss) Choose.ShowDialog() self.Hide() except Exception, e: tracelog = traceback.format_exc() MessageBox.Show(str(e))
def Confirm_Click(self, sender, e): x = self.Nama.Text.ToString() if x == "" or self.ComboTempat.Text == None: MessageBox.Show("Belum Diisi") else: #menentukan Gender if self.ComboTempat.Text == self.comboBox.Items.GetItemAt( 0).ToString(): gender = "Mas" # MessageBox.Show("Halo Mas "+x+ " yang suka") elif self.ComboTempat.Text == self.comboBox.Items.GetItemAt( 1).ToString(): gender = "mbak" # MessageBox.Show("Halo Mbak ") #menentukan Hobi MessageBox.Show("Halo " + gender + " " + x + " yang hobinya ") pass pass
def SetOptimizatonParameters(): print("In SetOptimizatonParameters") print("{0}, {1}, {2}, {3}, {4}, {5}".format(maxNumberOfIterations, iterationsInPreparationsPhase, computeFinalDose, isValid, canSetParameters, maxMuPerFxPerBeam)) for optimization in plan.PlanOptimizations: optimization.OptimizationParameters.Algorithm.MaxNumberOfIterations = maxNumberOfIterations optimization.OptimizationParameters.DoseCalculation.IterationsInPreparationsPhase = iterationsInPreparationsPhase optimization.OptimizationParameters.DoseCalculation.ComputeFinalDose = computeFinalDose #optimizedBeamSets = [] for optimizedBeamSet in optimization.OptimizedBeamSets: #optimizedBeamSets.append(optimizedBeamSet.DicomPlanLabel) dicomPlanLabel = optimizedBeamSet.DicomPlanLabel message = "Set Optimization Parameters\n" #message += "Beam Sets: " + ",".join(optimizedBeamSets) + "\n" message += "Beam Set: {0}".format(dicomPlanLabel) + "\n" message += "Max number of iterations: {0}\n".format(maxNumberOfIterations) message += "Iterations before conversion: {0}\n".format(iterationsInPreparationsPhase) message += "Compute final dose: {0}\n".format(str(computeFinalDose)) MessageBox.Show(message) treatmentSetupSettings = optimization.OptimizationParameters.TreatmentSetupSettings if constrainMaxMu: message = 'Set Max MU for all Arc beams as {0}'.format(maxMuPerFxPerBeam) message += '\n' message += 'CreateDualArcs -> False and BurstGantrySpacing -> None' MessageBox.Show(message) else: MessageBox.Show('Unchecked "Limit MU Apply" for all arc beams') for setting in treatmentSetupSettings: for beamSetting in setting.BeamSettings: if not beamSetting.ForBeam.DeliveryTechnique == 'Arc': break if constrainMaxMu: SetMaxArcMu(beamSetting, maxMuPerFxPerBeam) else: SetMaxArcMu(beamSetting, None)
def alg(graph, asal, tujuan): jarak_terpendek = {} preD = {} unseenNodes = graph infinity = float('inf') path = [] for node in unseenNodes: jarak_terpendek[node] = infinity jarak_terpendek[asal] = 0 while unseenNodes: minNode = None for node in unseenNodes: if minNode is None: minNode = node elif jarak_terpendek[node] < jarak_terpendek[minNode]: minNode = node for childNode, weight in graph[minNode].items(): if weight + jarak_terpendek[minNode] < jarak_terpendek[ childNode]: jarak_terpendek[ childNode] = weight + jarak_terpendek[minNode] preD[childNode] = minNode unseenNodes.pop(minNode) currentNode = tujuan while currentNode != asal: try: path.insert(0, currentNode) currentNode = preD[currentNode] except KeyError: MessageBox.Show('Tidak Ada Jalan') break path.insert(0, asal) if jarak_terpendek[tujuan] != infinity: MessageBox.Show('Jaraknya ' + str(jarak_terpendek[tujuan]) + ' m') MessageBox.Show('Jalurnya melewati ' + str(path))
def hit(self, sender, e): x = self.TextNama.Text.ToString() bra = sum(self.barang) brb = str(bra) hita = sum(self.hitung) hitb = str(hita) def error(): MessageBox.Show("Enter your name") return 0 if x == "": error() else: anonim_func = lambda pembeli: str(pembeli) ty = anonim_func("~~TERIMAKASIH SUDAH MEMBELI DI TOKO KAMI~~") MessageBox.Show("Hallo " + x + " anda telah membeli " + brb + " item pada toko kami" + "\n" + "dengan total biaya Rp." + hitb) MessageBox.Show(ty) pass
def salvar(self, sender, e): pessoa = Pessoa(self.txtNome.Text, self.txtEmail.Text, self.txtCpf.Text) try: self.validar_pessoa(pessoa) if (self.id == None): self.salvar_arquivo(self.NOME_ARQUIVO, self.APPEND_TO_FILE, pessoa) self.limpar(sender, e) else: self.lvPessoas.ItemsSource[self.id] = pessoa self.lvPessoas.Items.Refresh() itens = self.lvPessoas.Items self.editar_arquivo(self.NOME_ARQUIVO, self.WRITE, itens) self.limpar(sender, e) self.listar() MessageBox.Show('Pessoa salva!') except Exception as error: MessageBox.Show(error.message) pass pass
def Info_Button_Click(self, sender, e): time = strftime("%H:%M:%S") major = str(OSVersion.Version.Major) minor = str(OSVersion.Version.Minor) kernel = major + "." + minor # opsys = "Unknown" if kernel == "6.2": opsys = "Windows 8" elif kernel == "6.1": opsys = "Windows 7" elif kernel == "6.0": opsys = "Windows Vista" else: opsys = "Windows XP" MessageBox.Show("Information about your PC: \n \n" + "OS Version = " + opsys + "\nKernel Version = " + kernel, "PC Information")
def salvar(self, sender, e): produto = Produto(self.txtNome.Text, self.txtPreco.Text, self.txtDescricao.Text, self.cbCategoria.SelectedIndex) try: self.validar_produto(produto) if (self.id == None): self.salvar_arquivo(self.NOME_ARQUIVO, self.APPEND_TO_FILE, produto) self.limpar(sender, e) else: self.lvProdutos.ItemsSource[self.id] = produto self.lvProdutos.Items.Refresh() itens = self.lvProdutos.Items self.editar_arquivo(self.NOME_ARQUIVO, self.WRITE, itens) self.limpar(sender, e) self.listar() MessageBox.Show('Produto salvo!') except Exception as error: MessageBox.Show(error.message) pass pass
def listar(self): pessoas = [] try: file = open(self.NOME_ARQUIVO, self.READ_FILE) for f in file: split = f.split(',') pessoa = Pessoa(split[0], split[1], split[2].replace('\n', '')) pessoas.append(pessoa) file.close() except IOError as error: print(error) MessageBox.Show( 'Ocorreu um erro ao tentar ler o arquivo.\n{0}'.format( error.strerror)) self.lvPessoas.ItemsSource = pessoas
def error(): MessageBox.Show("Enter your name") return 0
def error(): MessageBox.Show("There is an empty box") return 0
scriptsPath = RayStationScriptsPath + "Scripts" print "Scripts path: " + scriptsPath sys.path.append(scriptsPath) clr.AddReference("BrainDoseIndices") from BrainDoseIndices.Views import MainWindow from BrainDoseIndices.Models import StructureDetail from Helpers import GetStructureSet, GetRoiDetails from Helpers import MakeMarginAddedRoi, MakeRingRoi, MakeRoiSubtractedRoi try: plan = get_current("Plan") except: MessageBox.Show("Plan is not selected. Select Plan") sys.exit() structureSet = plan.GetStructureSet() roiDetails = GetRoiDetails(structureSet) structureDetails = List[StructureDetail]() for key, value in roiDetails.items(): if value["HasContours"]: structureDetail = StructureDetail(); structureDetail.Name = key structureDetail.Volume = value["Volume"] structureDetails.Add(structureDetail) mainWindow = MainWindow(structureDetails) mainWindow.ShowDialog();
from connect import * import wpf from System.Windows import MessageBox case = get_current('Case') plan = get_current('Plan') planName = plan.Name newPlanName = planName + ' Dose' case.CopyPlan(PlanName=planName, NewPlanName=newPlanName) newPlan = case.TreatmentPlans[newPlanName] for bs in newPlan.BeamSets: bs.ComputeDose(ComputeBeamDoses=True, DoseAlgorithm='CCDose', ForceRecompute=True) MessageBox.Show('Done: Copy plan and Recompute dose')