def button_process(root): #create message box messagebox.askokcancel('Python Tkinter', 'Are you sure to create a window?') messagebox.askquestion('Python Tkinter', "Are you sure to create a window?") messagebox.askyesno('Python Tkinter', 'Are you sure to create a window?') messagebox.showerror('Python Tkinter', 'Unknown Error') messagebox.showinfo('Python Tkinter', 'hello world') messagebox.showwarning('Python Tkinter', 'Leave now') root1 = Toplevel(root)
def fermer(root): with open('Ressources/data/langue', 'rb') as langue: langue_depickler = pickle.Unpickler(langue) var_langue = langue_depickler.load() if var_langue == "francais": if messagebox.askokcancel("Quitter", "Voulez-vous vraiment quitter ?"): root.destroy() exit() else: if messagebox.askokcancel("Exit", "Do you really want to exit ?"): root.destroy() exit()
def set_stop_price(self, event=None): result = messagebox.askokcancel("强行平仓", "确认将当前持有合约强行平仓吗?") if result: # 设置止盈止损单 symbol = self.boxSymbols.get( self.boxSymbols.curselection()) # self.varSymbol.get() if symbol == '': return False caption = self.btnRight.cget('text') direction, offset = '', '' if caption == '空单平仓': direction = 'buy' offset = 'close' if caption == '多单平仓': direction = 'sell' offset = 'close' params = { 'direction': direction, 'symbol': symbol, 'offset': offset, 'period': self.Combobox.get(), 'order_price_type': 9, # 强行平仓,针对瀑布行情 } _r = self.win_main.http_get_request( '%s/trade' % self.win_main.baseUrl, params) if isinstance(_r, dict) and _r['status'] == 'ok': self.varTradeInfo.set('%s成功! ' % caption) elif isinstance(_r, dict): self.statusTxt.set('%s失败: %s' % (caption, _r['err_msg'])) else: self.statusTxt.set('操作失败!请检测是否登陆账户!') return False
def mquit(): #os.rmdir(log_path) #remove the log_folder but only if its empty mExit = messagebox.askokcancel(title="Quit", message="Are You Sure") if (mExit): shutil.rmtree( log_path, ignore_errors=True ) #remove the log_folder. doesn't check whether empty or not. sys.exit()
def install_examples(): """ Pops up windows to allow the user to choose a directory for installation of sfc_models examples. Uses tkinter, which is installed in base Python (modern versions). :return: """ if not mbox.askokcancel(title='sfc_models Example Installation', message=validate_str): return target = fdog.askdirectory( title='Choose directory to for sfc_models examples installation') if target == () or target == '': return install_example_scripts.install(target)
def on_closing(): if messagebox.askokcancel("Quit", "Do you want to quit?"): root.destroy() sys.exit()
def showOkCancelBox(self): if messagebox.askokcancel("Question", "This will delete the text"): self.entry.delete(0,END)