当前位置: 首页>>代码示例>>Python>>正文


Python tkinter.messagebox方法代码示例

本文整理汇总了Python中tkinter.messagebox方法的典型用法代码示例。如果您正苦于以下问题:Python tkinter.messagebox方法的具体用法?Python tkinter.messagebox怎么用?Python tkinter.messagebox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tkinter的用法示例。


在下文中一共展示了tkinter.messagebox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: send

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import messagebox [as 别名]
def send(*args):
    # 没有添加的话发送信息时会提示没有聊天对象
    users.append('------Group chat-------')
    users.append('Robot')
    print(chat)
    if chat not in users:
        tkinter.messagebox.showerror('Send error', message='There is nobody to talk to!')
        return
    if chat == 'Robot':
        print('Robot')
    if chat == user:
        tkinter.messagebox.showerror('Send error', message='Cannot talk with yourself in private!')
        return
    mes = entry.get() + ':;' + user + ':;' + chat  # 添加聊天对象标记
    s.send(mes.encode())
    a.set('')  # 发送后清空文本框


# 创建发送按钮 
开发者ID:11ze,项目名称:The-chat-room,代码行数:21,代码来源:client-test2.py

示例2: print_selection

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import messagebox [as 别名]
def print_selection(self, *e):
        if self._root is None: return
        if self._selection is None:
            tkinter.messagebox.showerror('Print Error', 'No tree selected')
        else:
            c = self._cframe.canvas()
            for widget in self._treewidgets:
                if widget is not self._selection:
                    self._cframe.destroy_widget(widget)
            c.delete(self._selectbox)
            (x1,y1,x2,y2) = self._selection.bbox()
            self._selection.move(10-x1,10-y1)
            c['scrollregion'] = '0 0 %s %s' % (x2-x1+20, y2-y1+20)
            self._cframe.print_to_file()

            # Restore our state.
            self._treewidgets = [self._selection]
            self.clear()
            self.update() 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:21,代码来源:chartparser_app.py

示例3: load_chart

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import messagebox [as 别名]
def load_chart(self, *args):
        "Load a chart from a pickle file"
        filename = askopenfilename(filetypes=self.CHART_FILE_TYPES,
                                   defaultextension='.pickle')
        if not filename: return
        try:
            with open(filename, 'rb') as infile:
                chart = pickle.load(infile)
            self._chart = chart
            self._cv.update(chart)
            if self._matrix: self._matrix.set_chart(chart)
            if self._matrix: self._matrix.deselect_cell()
            if self._results: self._results.set_chart(chart)
            self._cp.set_chart(chart)
        except Exception as e:
            raise
            tkinter.messagebox.showerror('Error Loading Chart',
                                   'Unable to open file: %r' % filename) 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:20,代码来源:chartparser_app.py

示例4: load_grammar

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import messagebox [as 别名]
def load_grammar(self, *args):
        "Load a grammar from a pickle file"
        filename = askopenfilename(filetypes=self.GRAMMAR_FILE_TYPES,
                                   defaultextension='.cfg')
        if not filename: return
        try:
            if filename.endswith('.pickle'):
                with open(filename, 'rb') as infile:
                    grammar = pickle.load(infile)
            else:
                with open(filename, 'r') as infile:
                    grammar = CFG.fromstring(infile.read())
            self.set_grammar(grammar)
        except Exception as e:
            tkinter.messagebox.showerror('Error Loading Grammar',
                                   'Unable to open file: %r' % filename) 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:18,代码来源:chartparser_app.py

示例5: save_grammar

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import messagebox [as 别名]
def save_grammar(self, *args):
        filename = asksaveasfilename(filetypes=self.GRAMMAR_FILE_TYPES,
                                     defaultextension='.cfg')
        if not filename: return
        try:
            if filename.endswith('.pickle'):
                with open(filename, 'wb') as outfile:
                    pickle.dump((self._chart, self._tokens), outfile)
            else:
                with open(filename, 'w') as outfile:
                    prods = self._grammar.productions()
                    start = [p for p in prods if p.lhs() == self._grammar.start()]
                    rest = [p for p in prods if p.lhs() != self._grammar.start()]
                    for prod in start: outfile.write('%s\n' % prod)
                    for prod in rest: outfile.write('%s\n' % prod)
        except Exception as e:
            tkinter.messagebox.showerror('Error Saving Grammar',
                                   'Unable to open file: %r' % filename) 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:20,代码来源:chartparser_app.py

示例6: __mainWindow

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import messagebox [as 别名]
def __mainWindow (self) :
		# master是TK框架的一个主线索,GUI的配置项都是从master着手
		self.master = tkinter.Tk()

		self.master.title(self.winTitle)
		self.master.resizable(width = 'false', height = 'false')
		if self.Tools.isWin() :  # 避免因为系统的原因导致获取不到图标
			self.master.iconbitmap(self.Tools.getRes('biticon.ico'))

		self.__topBox()  

		self.Cfg = Config.Config()
		if self.Cfg.connStat :
			menuBar = MenuBarView.GUI(self.master)
			menuBar.show()
		else :
			tkinter.messagebox.showinfo('Error', '创建配置文件失败。\r\n请检查「~/Library/Application Support」文件夹是否有操作权限!') 
开发者ID:EvilCult,项目名称:moviecatcher,代码行数:19,代码来源:MainView.py

示例7: __getLoginInput

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import messagebox [as 别名]
def __getLoginInput (self, callback = '') :
		time.sleep(5)

		if self.browser.title == '百度网盘-全部文件' :
			cookies =  self.browser.get_cookies()
			cookieStr = ''
			for x in cookies :
				cookieStr += x['name'] + '=' + x['value'] + '; '

			result = {'stat': 1, 'msg': '获取成功'}
		else :
			result = {'stat': 2, 'msg': '获取失败'}

		self.browser.quit()

		if result['stat'] == 1 :
			self.slave.destroy()
			tkinter.messagebox.showinfo('Success', '登陆成功')
			callback(cookieStr)
		else :
			tkinter.messagebox.showinfo('Error', result['msg']) 
开发者ID:EvilCult,项目名称:moviecatcher,代码行数:23,代码来源:PlayerView.py

示例8: __start_client__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import messagebox [as 别名]
def __start_client__(self):
		"""(Private) Starts the client side."""
		# Initialize the client object
		self.client = TTTClientGameGUI();
		# Gives the client a reference to self 
		self.client.canvas = self;
		try:
			# Get the host IP address
			host = socket.gethostbyname('s.CharmySoft.com');
		except:
			# If can't get the host IP from the domain
			tkinter.messagebox.showerror("Error", "Failed to get the game "+ 
				"host address from the web domain.\n" + 
				"Plase check your connection.");
			self.__on_return_clicked__();
			return;
		# Set the notif text
		self.set_notif_text("Connecting to the game server " + host + "...");
		# Connect to the server
		if(self.client.connect(host, "8080")):
			# If connected to the server
			# Start the game
			self.client.start_game();
			# Close the client
			self.client.close(); 
开发者ID:chen-yumin,项目名称:tic-tac-toe-in-python,代码行数:27,代码来源:ttt_client_gui.py

示例9: wclose

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import messagebox [as 别名]
def wclose(self, event=0):
        if self.parent.title()[0] == "*":
            save = messagebox.askyesnocancel(
                "Save file",
                "You have unsaved changes.\nDo you want to save before closing?",
            )

            if save:
                self.save_file()
                if self.parent.title()[0] == "*":
                    self.wclose()
                else:
                    root.destroy()

            elif not save:
                root.destroy()
        else:
            root.destroy() 
开发者ID:Abdur-rahmaanJ,项目名称:greenBerry,代码行数:20,代码来源:gb_ide.py

示例10: _properties

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import messagebox [as 别名]
def _properties(self, evt):
        if self.canvas.ruler is not None:
            self.canvas.delete(self.canvas.ruler)
            self.canvas.ruler = -1
        i = self.canvas.find_closest(
            self.canvas.canvasx(evt.x), self.canvas.canvasy(evt.y)
        )
        bb = self.canvas.bbox(i)
        if bb is not None:
            bb = (
                bb[0] * self.scale,
                -bb[3] * self.scale,
                bb[2] * self.scale,
                -bb[1] * self.scale,
            )
            tags = self.canvas.gettags(i)
            if "TEXT" not in tags:
                tkinter.messagebox.showinfo(
                    "Element information",
                    "Layer/datatpe: {0}\nVertices: {1}\nApproximate bounding box:\n({2[0]:g}, {2[1]:g}) - ({2[2]:g}, {2[3]:g})".format(
                        tags[0][1:], tags[1][1:], bb
                    ),
                    parent=self.canvas,
                ) 
开发者ID:heitzmann,项目名称:gdspy,代码行数:26,代码来源:viewer.py

示例11: login

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import messagebox [as 别名]
def login(*args):
    global IP, PORT, user
    IP, PORT = entryIP.get().split(':')  # 获取IP和端口号
    PORT = int(PORT)                     # 端口号需要为int类型
    user = entryUser.get()
    if not user:
        tkinter.messagebox.showerror('Name type error', message='Username Empty!')
    else:
        root1.destroy()                  # 关闭窗口 
开发者ID:11ze,项目名称:The-chat-room,代码行数:11,代码来源:client-test2.py

示例12: save_chart_dialog

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import messagebox [as 别名]
def save_chart_dialog(self, *args):
        filename = asksaveasfilename(filetypes=self.CHART_FILE_TYPES,
                                     defaultextension='.pickle')
        if not filename: return
        try:
            with open(filename, 'wb') as outfile:
                pickle.dump(self._out_chart, outfile)
        except Exception as e:
            tkinter.messagebox.showerror('Error Saving Chart',
                                   'Unable to open file: %r\n%s' %
                                   (filename, e)) 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:13,代码来源:chartparser_app.py

示例13: load_chart_dialog

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import messagebox [as 别名]
def load_chart_dialog(self, *args):
        filename = askopenfilename(filetypes=self.CHART_FILE_TYPES,
                                   defaultextension='.pickle')
        if not filename: return
        try: self.load_chart(filename)
        except Exception as e:
            tkinter.messagebox.showerror('Error Loading Chart',
                                   'Unable to open file: %r\n%s' %
                                   (filename, e)) 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:11,代码来源:chartparser_app.py

示例14: about

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import messagebox [as 别名]
def about(self, *e):
        ABOUT = ("NLTK Chart Parser Application\n"+
                 "Written by Edward Loper")
        tkinter.messagebox.showinfo('About: Chart Parser Application', ABOUT)

    #////////////////////////////////////////////////////////////
    # File Menu
    #//////////////////////////////////////////////////////////// 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:10,代码来源:chartparser_app.py

示例15: launch_tagger

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import messagebox [as 别名]
def launch_tagger(self):
        current_files = self.file_selector.files()
        if not current_files:
            tkinter.messagebox.showwarning("launching SEM", "No files specified.")
            return
        
        workflow = self.master.workflow()
        if not workflow:
            tkinter.messagebox.showwarning("launching SEM", "No workflow selected.")
            return
        masterfile = os.path.join(self.resource_dir, "master", self.lang_selector.lang(), workflow)
        
        output_dir = os.path.join(self.current_output, time.strftime("%Y%m%d%H%M%S"))
        if not os.path.exists(output_dir):
            os.makedirs(output_dir)
        
        try:
            export_format = self.export_format_selector.export_format()
            pipeline, workflow_options, exporter, couples = load_master(masterfile, force_format=export_format)
            args = Holder(**{"infiles": [], "output_directory":output_dir, "pipeline":pipeline, "options":workflow_options, "exporter":exporter, "couples":couples, "n_procs":0})
            for current_file in current_files:
                corpus = None
                try:
                    corpus = SEMCorpus.from_xml(current_file)
                except:
                    pass
                if corpus is not None:
                    args.infiles.extend(corpus.documents)
                else:
                    args.infiles.append(current_file)
            tagger(args)
        except Exception as e:
            tkinter.messagebox.showerror("launching SEM", "Error: " + str(e)) # handling ExpatError from etree
            raise
            return
        gui_logger.info("files are located in: " + output_dir)
        tkinter.messagebox.showinfo("launching SEM", "Everything went ok! files are located in: " + output_dir)
        return 
开发者ID:YoannDupont,项目名称:SEM,代码行数:40,代码来源:gui.py


注:本文中的tkinter.messagebox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。