Python tkinter.messagebox 模块,showwarning() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用tkinter.messagebox.showwarning()

项目:FBIThemePreviewer    作者:jurassicplayer    | 项目源码 | 文件源码
def loadTheme(self, folderpath):
        print("Loading theme: {}".format(folderpath))
        self.observer.unschedule_all()
        if os.path.isdir(folderpath):
            self.app_config['theme_folder'] = folderpath
            self.loadConfig(self.text_config, os.path.join(folderpath,'textcolor.cfg'), argb_check=True)
            failed_to_load = []
            for key in self.i:
                failed_filename = self.loadImage(folderpath, key)
                if failed_filename:
                    failed_to_load.append("{}.png".format(failed_filename))
            if failed_to_load:
                failed_to_load.sort()
                messagebox.showwarning("Error", 'Failed to load {}/{} image(s):\n{}'.format(len(failed_to_load), len(self.i)-3, "\n".join(failed_to_load)))
            self.observer.schedule(FSEventHandler(self), folderpath, recursive=False)
        else:
            messagebox.showwarning("Error", 'Theme path not found:\n{}'.format(folderpath))
项目:FBIThemePreviewer    作者:jurassicplayer    | 项目源码 | 文件源码
def loadTheme(self, folderpath):
        print("Loading theme: {}".format(folderpath))
        self.observer.unschedule_all()
        if os.path.isdir(folderpath):
            self.app_config['theme_folder'] = folderpath
            self.loadConfig(self.text_config, os.path.join(folderpath,'textcolor.cfg'), argb_check=True)
            failed_to_load = []
            for key in self.i:
                failed_filename = self.loadImage(folderpath, key)
                if failed_filename:
                    failed_to_load.append("{}.png".format(failed_filename))
            if failed_to_load:
                failed_to_load.sort()
                messagebox.showwarning("Error", 'Failed to load {}/{} image(s):\n{}'.format(len(failed_to_load), len(self.i)-3, "\n".join(failed_to_load)))
            self.observer.schedule(FSEventHandler(self), folderpath, recursive=False)
            self.rebuildCache()
        else:
            messagebox.showwarning("Error", 'Theme path not found:\n{}'.format(folderpath))
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def main():
    # ?????????,?????Tkinter????????Tk??.??????withdraw()??????
    tk = tkinter.Tk()
    tk.withdraw()  # ?????

    print(dir(mb))

    # ??,?????????,??ok,????????????.??????????????,??????????.
    # ??,???Cancel?,??????None
    mb.showinfo("Title", "Your message here")
    mb.showerror("An Error", "Oops!")
    mb.showwarning("Title", "This may not work...")
    mb.askyesno("Title", "Do you love me?")
    mb.askokcancel("Title", "Are you well?")
    mb.askquestion("Title", "How are you?")
    mb.askretrycancel("Title", "Go again?")
    mb.askyesnocancel("Title", "Are you well?")
项目:CS-4400-Georgia-Restaurant-Inspections-report-database    作者:itsxiaoxiaoxiaoxiaoyu    | 项目源码 | 文件源码
def operatorButtonClicked(self):
        username = self.username.get()
        password = self.password.get()
        if not username:
            messagebox.showwarning("Username input is empty", "Please enter username.")
            return False
        if not password:
            messagebox.showwarning("Password input is empty", "Please enter password")
            return False
        isAnOperatorUsername = self.cursor.execute("SELECT * FROM operatorowner WHERE username = %s", username)
        if not isAnOperatorUsername:
            messagebox.showwarning("Username is not an operator\'s username",
                                   "The username you entered is not an operator\'s username.")
            return False
        usernameAndPasswordMatch = self.cursor.execute(
            "SELECT * FROM registereduser WHERE (username = %s AND password = %s)", (username, password))
        if not usernameAndPasswordMatch:
            messagebox.showwarning("Username and password don\'t match", "Sorry, the username and password you entered"
                                                                         + " do not match.")
            return False
        self.loginWindow.withdraw()
        operator = Operator(username)
        return True
项目:CS-4400-Georgia-Restaurant-Inspections-report-database    作者:itsxiaoxiaoxiaoxiaoyu    | 项目源码 | 文件源码
def inspectorButtonClicked(self):
        username = self.username.get()
        password = self.password.get()
        if not username:
            messagebox.showwarning("Username input is empty", "Please enter username.")
            return False
        if not password:
            messagebox.showwarning("Password input is empty", "Please enter password")
            return False
        isAnInspectorUsername = self.cursor.execute("SELECT * FROM inspector WHERE username = %s", username)
        if not isAnInspectorUsername:
            messagebox.showwarning("Username is not an inspector\'s username",
                                   "The username you entered is not an inspector\'s username.")
            return False
        usernameAndPasswordMatch = self.cursor.execute(
            "SELECT * FROM registereduser WHERE (username = %s AND password = %s)", (username, password))
        if not usernameAndPasswordMatch:
            messagebox.showwarning("Username and password don\'t match", "Sorry, the username and password you entered"
                                                                         + " do not match.")
            return False
        self.loginWindow.withdraw()
        inspector = Inspector()
        return True
项目:Weather    作者:dev4love    | 项目源码 | 文件源码
def _searchCity(self):
        self.info.delete(u'1.0', tk.END)

        _cityName = self.cityName.get()
        if len(_cityName) == 0:
            messagebox.showwarning(u'Please input a city name', u'Please input a city name for search.')
            return

        cities = self.api.queryCityInfo(_cityName)
        # print(cities)
        if len(cities) == 0:
            messagebox.showerror(u'???????', u'??????????????')
            return
        elif len(cities) == 1:
            self._showWeather(cities[0])

        else:
            self._askForSelect(cities)
项目:stash-scanner    作者:senuido    | 项目源码 | 文件源码
def processMessages(self):
        try:
            while True:
                type, args = self._queue.get_nowait()
                if type == _MSG_UPDATE:
                    text, progress = args
                    self.lbl_info.config(text=text)
                    if self.determinate:
                        self.pb_progress.config(value=progress)
                elif type == _MSG_CLOSE:
                    self.destroy()
                elif type == _MSG_NOTIFY:
                    title, message = args
                    messagebox.showwarning(title, message, parent=self)

        except queue.Empty:
            pass

        self.after(100, self.processMessages)
项目:Trip-Helper    作者:HezhiWang    | 项目源码 | 文件源码
def check_click1(self, controller, w):
        """
        This function pass the user choosed time as parameters to method combined_function1 and call the combined_function1 method.

        Parameters: 
            w: tk.Listbox()
            controller
        Execptions:
            catch IndexError exceptions to let user choose some stuff in the listbox
        """
        try:
            if (not w.curselection()):
                raise IndexError  

            if w.get(w.curselection()) == 'Tight':           
                self.combined_function1(1, controller)
            elif w.get(w.curselection()) == 'Moderate':
                self.combined_function1(2, controller)
            elif w.get(w.curselection()) == 'Adequate':
                self.combined_function1(3, controller) 
        except IndexError:
            messagebox.showwarning("Error", "Please select one of the items in the listbox")
项目:Trip-Helper    作者:HezhiWang    | 项目源码 | 文件源码
def check_click2(self, w):
        """
        This function choose the last paramter, and then call the trip_planer function to design the travel route 
        for users automatically including the attractions, hotels and restaurant recommendations based on their prefenrances, 
        and output the results in a txt file.

        Parameters: 
            w: tk.Listbox()

        Execptions:
            catch IndexError exceptions to let user choose some stuff in the listbox
        """
        try:
            if (not w.curselection()):
                raise IndexError  
            elif w.get(w.curselection()) == 'Tight Schedule':     
                t = trip_plan(Time, Bugdet, 2)
                t.trip_planer()
            elif w.get(w.curselection()) == 'Flexible Schedule':                         
                t = trip_plan(Time, Bugdet, 1)  
                t.trip_planer()
        except IndexError:
            messagebox.showwarning("Error", "Please select one of the items in the listbox")
项目:Trip-Helper    作者:HezhiWang    | 项目源码 | 文件源码
def check_click4(self, w, controller):
        """
        This function let user choose what they want to overview from 'Restaurant', 'hotel', 'museum', 'attraction',
        and plot their heatmap in a html file, and open it automaticlly.

        Parameters: 
            w: tk.Listbox()

        Execptions:
            catch IndexError exceptions to let user choose some stuff in the listbox
        """
        try:
            if (not w.curselection()):
                raise IndexError

            if w.get(w.curselection()) == 'Restaurant':
                controller.show_frame(Overview_restaurant, lat, logi)                                       
            elif w.get(w.curselection()) == 'Hotel':
                controller.show_frame(Overview_hotel, lat, logi)
            elif w.get(w.curselection()) == 'Attraction':
                controller.show_frame(Overview_attractions, lat, logi)
            elif w.get(w.curselection()) == 'Museum':
                controller.show_frame(Overview_museums, lat, logi)   
        except IndexError:
            messagebox.showwarning("Error", "Please select one of the items in the listbox")
项目:SceneDensity    作者:ImOmid    | 项目源码 | 文件源码
def warningBox(self, title, message):
        self.topLevel.update_idletasks()
        MessageBox.showwarning(title, message)
        self.__bringToFront()
项目:Cryptokey_Generator    作者:8BitCookie    | 项目源码 | 文件源码
def warningBox(self, title, message):
        self.topLevel.update_idletasks()
        MessageBox.showwarning(title, message)
        self.__bringToFront()
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def _msgBox():
#     msg.showinfo('Python Message Info Box', 'A Python GUI created using tkinter:'
#                   '\nThe year is 2017.')  
    msg.showwarning('Python Message Warning Box', 'A Python GUI created using tkinter:'
                    '\nWarning: There might be a bug in this code.')

# Add another Menu to the Menu Bar and an item
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def _msgBox():
#     msg.showinfo('Python Message Info Box', 'A Python GUI created using tkinter:\nThe year is 2017.')  
#     msg.showwarning('Python Message Warning Box', 'A Python GUI created using tkinter:'
#                       '\nWarning: There might be a bug in this code.')
    msg.showerror('Python Message Error Box', 'A Python GUI created using tkinter:'
                  '\nError: Houston ~ we DO have a serious PROBLEM!')

# Add another Menu to the Menu Bar and an item
项目:Quiver    作者:DeflatedPickle    | 项目源码 | 文件源码
def load_properties(self):
        try:
            with open("properties.json", "r") as file:
                self.properties = json.loads(jsonesque.process(file.read()))
                file.close()
        except FileNotFoundError:
            # print("{} | FileNotFoundError: 'properties.json' not found.".format(datetime.now().strftime("%H:%M:%S")))
            messagebox.showwarning(title="Warning", message="Could not find 'properties.json'.")
项目:Quiver    作者:DeflatedPickle    | 项目源码 | 文件源码
def write_properties(self, key, value):
        try:
            with open("properties.json", "w+") as file:
                self.properties[key] = value
                # print(self.properties)
                file.write(json.dumps(self.properties, sort_keys=False, indent=2))
                file.close()
        except FileNotFoundError:
            # print("{} | FileNotFoundError: 'properties.json' not found.".format(datetime.now().strftime("%H:%M:%S")))
            messagebox.showwarning(title="Warning", message="Could not find 'properties.json'.")
项目:Craft-Clash    作者:Derpyface-Development-Co    | 项目源码 | 文件源码
def validate(self):
        try:
            result = self.getresult()
        except ValueError:
            messagebox.showwarning(
                "Illegal value",
                self.errormessage + "\nPlease try again",
                parent = self
            )
            return 0

        if self.minvalue is not None and result < self.minvalue:
            messagebox.showwarning(
                "Too small",
                "The allowed minimum value is %s. "
                "Please try again." % self.minvalue,
                parent = self
            )
            return 0

        if self.maxvalue is not None and result > self.maxvalue:
            messagebox.showwarning(
                "Too large",
                "The allowed maximum value is %s. "
                "Please try again." % self.maxvalue,
                parent = self
            )
            return 0

        self.result = result

        return 1
项目:Craft-Clash    作者:Derpyface-Development-Co    | 项目源码 | 文件源码
def validate(self):
        try:
            result = self.getresult()
        except ValueError:
            messagebox.showwarning(
                "Illegal value",
                self.errormessage + "\nPlease try again",
                parent = self
            )
            return 0

        if self.minvalue is not None and result < self.minvalue:
            messagebox.showwarning(
                "Too small",
                "The allowed minimum value is %s. "
                "Please try again." % self.minvalue,
                parent = self
            )
            return 0

        if self.maxvalue is not None and result > self.maxvalue:
            messagebox.showwarning(
                "Too large",
                "The allowed maximum value is %s. "
                "Please try again." % self.maxvalue,
                parent = self
            )
            return 0

        self.result = result

        return 1
项目:SPGL    作者:wynand1004    | 项目源码 | 文件源码
def show_warning(self, title, message):
        return messagebox.showwarning(title, message)
项目:SPGL    作者:wynand1004    | 项目源码 | 文件源码
def show_warning(self, title, message):
        return messagebox.showwarning(title, message)
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def validate(self):
        try:
            result = self.getresult()
        except ValueError:
            messagebox.showwarning(
                "Illegal value",
                self.errormessage + "\nPlease try again",
                parent = self
            )
            return 0

        if self.minvalue is not None and result < self.minvalue:
            messagebox.showwarning(
                "Too small",
                "The allowed minimum value is %s. "
                "Please try again." % self.minvalue,
                parent = self
            )
            return 0

        if self.maxvalue is not None and result > self.maxvalue:
            messagebox.showwarning(
                "Too large",
                "The allowed maximum value is %s. "
                "Please try again." % self.maxvalue,
                parent = self
            )
            return 0

        self.result = result

        return 1
项目:GUI_programming    作者:duolaAOA    | 项目源码 | 文件源码
def hit_me():
    #tk.messagebox.showinfo(title='Hi',message='hahaha')?????????????
    #?????????
    # msgbox.showinfo(title='Hi',message='hahaha')
    #?????????
    msgbox.showwarning(title='Hi',message='Fuck!')
    #?????????
    msgbox.showerror(title='Hi',message='ERROR!!')
    #???????,????YES?NO
    msgbox.askquestion(title='Hi',message='ERROR!!')
项目:GUI_programming    作者:duolaAOA    | 项目源码 | 文件源码
def confirm(self):

        port_1 = 'https://api.47ks.com/webcloud/?v='
        port_2 = 'http://www.wmxz.wang/video.php?url='
        port_3 = 'http://www.vipjiexi.com/yun.php?url='
        #??????????????
        if re.match(r'^https?:/{2}\w.+$', self.url.get()):

            #?????????????
            if (self.b1.get() + self.b2.get() + self.b3.get()) !=1:

                msgbox.showwarning(title='??',message='????????')


            elif self.b1.get() == True:

                webbrowser.open(port_1 + self.url.get())



            elif self.b2.get() == True:
                webbrowser.open(port_2 + self.url.get())


            else:
                self.b3.get() == True

                webbrowser.open(port_2 + self.url.get())

        else:
            msgbox.showerror(title='??',message='?????????!')
项目:Foxlogin    作者:callMePlus    | 项目源码 | 文件源码
def lookResult():
    GlobalVal.username = GlobalVal.root.usernameInput.get()
    if not os.path.exists(GlobalVal.username):
        m_title = "????"
        m = '??? \' %s \' ?????'% GlobalVal.username
        messagebox.showwarning(m_title, m)
    else:
        def sub_lookResult():
            subprocess.call('explorer %s' % GlobalVal.username)
        t_lookResult = threading.Thread(target=sub_lookResult, name='sub_lookResult')
        t_lookResult.start()

# ??????
项目:of    作者:OptimalBPM    | 项目源码 | 文件源码
def notify_messagebox(self, _title, _message, _kind=None):
        """Override as this is the top class, default is error."""
        if self.suppress_errors is None:
            if _kind == "message":
                messagebox.showinfo(_title, _message)
            elif _kind == "warning":
                messagebox.showwarning(_title, _message)
            else:
                messagebox.showerror(_title, _message)
项目:my_research    作者:MorvanZhou    | 项目源码 | 文件源码
def button_load_learning_result_clicked(self):
        global episode
        initialdir = os.path.dirname(os.path.realpath(__file__))
        while True:
            if platform.system() == 'Darwin':
                q_index_path = askopenfilename(initialdir=initialdir, message='Choose q_index',
                                       filetypes=[('pickle files', '*.pickle'),
                                                  ("All files", "*.*") ])
            else:
                q_index_path = askopenfilename(initialdir=initialdir, title='Choose q_index',
                                       filetypes=[('pickle files', '*.pickle'),
                                                  ("All files", "*.*") ])
            if 'q_index' not in q_index_path:
                messagebox.showwarning(message='Wrong file.')
            else:
                break
        while True:
            if platform.system() == 'Darwin':
                q_table_path = askopenfilename(initialdir=initialdir, message='Choose q_table',
                                       filetypes=[('pickle files', '*.pickle'),
                                                  ("All files", "*.*") ])
            else:
                q_table_path = askopenfilename(initialdir=initialdir, title='Choose q_table',
                                       filetypes=[('pickle files', '*.pickle'),
                                                  ("All files", "*.*") ])
            if 'q_table' not in q_table_path:
                messagebox.showwarning(message='Wrong file.')
            else:
                break

        try:
            hunter.q_table = pd.read_pickle(q_table_path)
            hunter.q_index = pd.read_pickle(q_index_path)
            episode = [int(d) for d in q_table_path.split('_') if d.isdigit()][0]
            self.label_episode_v.set('Episode: %s' % episode)
        except Exception as e:
            messagebox.showerror(message=e)
项目:FBIThemePreviewer    作者:jurassicplayer    | 项目源码 | 文件源码
def loadConfig(self, config_dict, filename, argb_check=False):
        print("Loading config: {}".format(filename))
        if os.path.isfile(filename):
            with open(filename) as f:
                config_content = [line.rstrip('\n') for line in f]
            malformed_color = []
            for key in config_dict:
                for line in config_content:
                    value = line.split("=")[1]
                    if key == line.split("=")[0]:
                        if argb_check:
                            argbstring = re.compile(r'[a-fA-F0-9]{8}$')
                            if argbstring.match(value):
                                A = value[:2]
                                RGB = swapRGBBGR(value[2:])
                                config_dict.update({key : {'rgb' : RGB, 'alpha' : A} })
                            else:
                                malformed_color.append(line)
                        else:
                            if key == "screen_gap" or key == "anim_duration":
                                try:
                                    value = int(value)
                                except:
                                    value = config_dict[key]
                            config_dict.update({key : value})
            if malformed_color:
                malformed_color.sort()
                messagebox.showwarning("Error", "Malformed text color (ABGR):\n{}".format('\n'.join(malformed_color)))
项目:FBIThemePreviewer    作者:jurassicplayer    | 项目源码 | 文件源码
def loadConfig(self, config_dict, filename, argb_check=False):
        print("Loading config: {}".format(filename))
        if os.path.isfile(filename):
            with open(filename) as f:
                config_content = [line.rstrip('\n') for line in f]
            malformed_color = []
            for key in config_dict:
                for line in config_content:
                    value = line.split("=")[1]
                    if key == line.split("=")[0]:
                        if argb_check:
                            argbstring = re.compile(r'[a-fA-F0-9]{8}$')
                            if argbstring.match(value):
                                a, b, g, r = tuple([value[i:i+2] for i in range(0, len(value), 2)])
                                config_dict.update({key : (int(r, 16), int(g, 16), int(b, 16), int(a, 16)) })
                                self.sliders[key][0].set(int(a, 16))
                            else:
                                malformed_color.append(line)
                        else:
                            if key == "screen_gap" or key == "anim_duration":
                                try:
                                    value = int(value)
                                except:
                                    value = config_dict[key]
                            config_dict.update({key : value})
            if malformed_color:
                malformed_color.sort()
                messagebox.showwarning("Error", "Malformed text color (ABGR):\n{}".format('\n'.join(malformed_color)))
项目:qal    作者:OptimalBPM    | 项目源码 | 文件源码
def notify_messagebox(self, _title, _message, _kind=None):
        """Override as this is the top class, default is error."""
        if self.suppress_errors is None:
            if _kind == "message":
                messagebox.showinfo(_title, _message)
            elif _kind == "warning":
                messagebox.showwarning(_title, _message)
            else:
                messagebox.showerror(_title, _message)
项目:jjal_downloader    作者:tucuprum    | 项目源码 | 文件源码
def DisplayError(errorMsg):
    messagebox.showwarning(PROGRAM_TITLE,errorMsg)
项目:python_tk_adb    作者:liwanlei    | 项目源码 | 文件源码
def monkey_app():
    status_shebei=huoqushebeizhuangtai()
    if status_shebei =='device':
        try:
            packname=baoming_t1.get('0.0',END).split()[0]
            zhongzi=zhongzi_t.get('0.0',END).split()[0]
            time=time_t.get().split()[0]
            touch=touch_t.get('0.0',END).split()[0]
            huadong=huadong_t.get('0.0',END).split()[0]
            guiji=guiji_t.get('0.0',END).split()[0]
            xitong=xitong_t.get('0.0',END).split()[0]
            acti=acti_t.get('0.0',END).split()[0]
            event=event_t.get('0.0',END).split()[0]
            log=log_t.get('0.0',END).split()[0]
            danghang=danghang_t.get('0.0',END).split()[0]
            if len(packname)<=5:
                LOG.info('???????')
                messagebox.showwarning('??','???????')
            if int(touch)+int(huadong)+int(guiji)+int(danghang)+int(xitong)+int(acti) >100:
                messagebox.showerror('??','?????????????????100%')
                LOG.info('?????????????????100')
            adb_monkey(packagename=packname,s_num=zhongzi,throttle=time,pct_touch=touch,pct_motion=huadong,pct_trackball=guiji,pct_nav=danghang,pct_syskeys=xitong,pct_appswitch=acti,num=event,logfilepath=log)
        except :
            messagebox.showwarning('??','????monkey????')
            LOG.info('monkey ???????:%s'%Exception)
    else:
        LOG.info('?????? ???????!')
        messagebox.showwarning('??','?????? ???????!')
项目:BeachedWhale    作者:southpaw5271    | 项目源码 | 文件源码
def warningBox(self, title, message):
        self.topLevel.update_idletasks()
        MessageBox.showwarning(title, message)
        self.__bringToFront()
项目:restclientgui    作者:profullstack    | 项目源码 | 文件源码
def onWarn(self,message):
        messagebox.showwarning("Warning", message)
项目:CS-4400-Georgia-Restaurant-Inspections-report-database    作者:itsxiaoxiaoxiaoxiaoyu    | 项目源码 | 文件源码
def submitReportButtonClicked(self):
        for i in range(0, 15):
            if not self.itemScoreList[i].get():
                messagebox.showwarning("Empty input", "Please enter a score for each item.")
                return False
        for i in range(0, 8):
            if not (int(self.itemScoreList[i].get()) in range(0, 10)):
                messagebox.showwarning("Input out of range", "For items 1-8, the score must be 0-9. You entered "
                                       + self.itemScoreList[i].get() + " for item " + str(i + 1) + ".")
                return False
        for i in range(8, 15):
            if not (int(self.itemScoreList[i].get()) in range(0, 5)):
                messagebox.showwarning("Input out of range", "For items 9-15, the score must be 0-4. You entered "
                                       + self.itemScoreList[i].get() + " for item " + str(i + 1) + ".")
                return False
        result = self.cursor.execute("SELECT iid FROM inspector WHERE iid = %s", self.inspectorID.get())
        if not result:
            messagebox.showwarning("Inspector ID is not exist")
            return False
        result = self.cursor.execute("SELECT rid FROM restaurant WHERE rid = %s", self.restaurantID.get())
        if not result:
            messagebox.showwarning("Restaurant ID is not exist")
            return False
        self.submitReportToDatabase()
        messagebox.showwarning("Submission successful", "Your report has been submitted.")
        self.insertReportWindow.withdraw()
        self.inspectorMenuWindow.deiconify()
        return True
#----------DATABASE INTERACTION METHODS---------------------------------------------
项目:CS-4400-Georgia-Restaurant-Inspections-report-database    作者:itsxiaoxiaoxiaoxiaoyu    | 项目源码 | 文件源码
def connect(self):
        try:
            db = pymysql.connect(host = 'academic-mysql.cc.gatech.edu',
                                 db = 'cs4400_Group_24', user = 'cs4400_Group_24', passwd = 'jGZgXJfO')
            return db
        except:
            messagebox.showwarning('Error!','Cannot connect. Please check your internet connection.')
            return False
项目:CS-4400-Georgia-Restaurant-Inspections-report-database    作者:itsxiaoxiaoxiaoxiaoyu    | 项目源码 | 文件源码
def connect(self):
        try:
            db = pymysql.connect(host = 'academic-mysql.cc.gatech.edu',
                                 db = 'cs4400_Group_24', user = 'cs4400_Group_24', passwd = 'jGZgXJfO')
            return db
        except:
            messagebox.showwarning('Error!','Cannot connect. Please check your internet connection.')
            return False
项目:CS-4400-Georgia-Restaurant-Inspections-report-database    作者:itsxiaoxiaoxiaoxiaoyu    | 项目源码 | 文件源码
def submitComplaintButtonClicked(self):
        #submit the complaint to database
        restaurant = self.complaintInfoList[0].get().split(',')[0]
        self.cursor.execute("SELECT rid FROM restaurant WHERE name = %s", restaurant)
        restaurantID = self.cursor.fetchone()[0]
        phone = self.complaintInfoList[4].get()
        cdate = self.complaintInfoList[1].get()
        customerFirstName = self.complaintInfoList[2].get()
        customerLastName = self.complaintInfoList[3].get()
        '''
        address = self.complaintInfoList[0].get().split(', ', 1)[1]
        print("address: " + address)
        self.cursor.execute("SELECT email FROM restaurant WHERE name = %s", restaurant)
        operatorEmail = self.cursor.fetchone()[0]
        print("email: " + operatorEmail)
        self.cursor.execute("SELECT firstname, lastname FROM operatorowner WHERE email = %s", operatorEmail)
        nameTuple = self.cursor.fetchall()
        operatorName = nameTuple[0][0] + ' ' + nameTuple[0][1]
        print(operatorName)
        self.cursor.execute("SELECT totalscore FROM inspection WHERE rid = %s ORDER BY idate DESC", restaurantID)
        score = self.cursor.fetchone()[0]
        print("score: " + str(score))
        '''
        complaint = self.complaintInfoList[-1].get()
        result = self.cursor.execute("SELECT * FROM customer WHERE phone = %s", phone)
        if not result:
            self.cursor.execute("INSERT INTO customer (phone, firstname, lastname) VALUES (%s, %s, %s)",
                            (phone, customerFirstName, customerLastName))
            self.db.commit()
        self.cursor.execute("INSERT INTO complaint (rid, phone, cdate, description) VALUES (%s, %s, %s, %s)",
                            (restaurantID, phone, cdate, complaint))
        self.db.commit()
        messagebox.showwarning("Submission Successful!", "Your complaint has been submitted.")
        self.fileComplaintWindow.withdraw()
        self.guestMenuWindow.deiconify()
项目:CS-4400-Georgia-Restaurant-Inspections-report-database    作者:itsxiaoxiaoxiaoxiaoyu    | 项目源码 | 文件源码
def connect(self):
        try:
            db = pymysql.connect(host = 'academic-mysql.cc.gatech.edu',
                                 db = 'cs4400_Group_24', user = 'cs4400_Group_24', passwd = 'jGZgXJfO')
            return db
        except:
            messagebox.showwarning('Error!','Cannot connect. Please check your internet connection.')
            return False
项目:CS-4400-Georgia-Restaurant-Inspections-report-database    作者:itsxiaoxiaoxiaoxiaoyu    | 项目源码 | 文件源码
def searchButtonClicked(self):
        if not self.restaurantIDChoice.get():
            messagebox.showwarning("Empty restaurant ID input", "Please select restaurant ID.")
            return False
        if not self.restaurantNameChoice.get():
            messagebox.showwarning("Empty restaurant name input", "Please select restaurant name.")
            return False
        if not self.addressChoice.get():
            messagebox.showwarning("Empty address input", "Please select restaurant address.")
            return False
        # Check if the choices match (as one restaurant)
        street = self.addressChoice.get().split(",")[0]
        result = self.cursor.execute("SELECT * FROM restaurant WHERE (rid = %s AND name = %s AND street = %s AND email = %s)",
                            (int(self.restaurantIDChoice.get()),
                             self.restaurantNameChoice.get(), street, self.email))
        if not result:
            messagebox.showwarning("Error", "The restaurant ID, name and address you selected do not match.")
            return False
        self.displayReportWindow.withdraw()
        self.buildGenerateReportWindow(self.restaurantIDChoice.get(),
                                       self.restaurantNameChoice.get(),
                                       self.addressChoice.get(),
                                       self.generateReportWindow)
        self.generateReportWindow.deiconify()

#------------------------------------BUILD WINDOW METHODS------------------------------------------------
项目:CS-4400-Georgia-Restaurant-Inspections-report-database    作者:itsxiaoxiaoxiaoxiaoyu    | 项目源码 | 文件源码
def connect(self):
        try:
            db = pymysql.connect(host = 'academic-mysql.cc.gatech.edu',
                                 db = 'cs4400_Group_24', user = 'cs4400_Group_24', passwd = 'jGZgXJfO')
            return db
        except:
            messagebox.showwarning('Error!','Cannot connect. Please check your internet connection.')
            return False
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def validate(self):
        try:
            result = self.getresult()
        except ValueError:
            messagebox.showwarning(
                "Illegal value",
                self.errormessage + "\nPlease try again",
                parent = self
            )
            return 0

        if self.minvalue is not None and result < self.minvalue:
            messagebox.showwarning(
                "Too small",
                "The allowed minimum value is %s. "
                "Please try again." % self.minvalue,
                parent = self
            )
            return 0

        if self.maxvalue is not None and result > self.maxvalue:
            messagebox.showwarning(
                "Too large",
                "The allowed maximum value is %s. "
                "Please try again." % self.maxvalue,
                parent = self
            )
            return 0

        self.result = result

        return 1
项目:repo    作者:austinHeisleyCook    | 项目源码 | 文件源码
def fileopen(self):
        try:
            self.v = self.fileName.get()
            with open(self.v, "r") as r:
                content = r.read()
                self.contents.insert(INSERT, content)
        except:
            messagebox.showwarning("error", "file not found")
项目:repo    作者:austinHeisleyCook    | 项目源码 | 文件源码
def save(self):
        try:
            self.v = self.fileName.get()
            with open(self.v, "a") as w:
                w.write(self.contents.get(1.0, END))
        except:
            messagebox.showwarning("error", "file not found")
项目:repo    作者:austinHeisleyCook    | 项目源码 | 文件源码
def clearfile(self):
        try:
            self.v = self.fileName.get()
            with open(self.v, "w+") as w:
                w.write("")
                self.contents.insert(INSERT, "")
        except:
            messagebox.showwarning("file not found")
项目:repo    作者:austinHeisleyCook    | 项目源码 | 文件源码
def overwrite(self):
        try:
            self.v = self.fileName.get()
            with open(self.v, "w") as w:
                w.write(self.contents.get(1.0, END))
        except:
            messagebox.showwarning("error", "file not found")
项目:repo    作者:austinHeisleyCook    | 项目源码 | 文件源码
def webview(self):
        try:
            self.v = self.fileName.get()
            with open(self.v, "r") as r:
                webbrowser.open_new(self.v)
        except:
            messagebox.showwarning("error", "file not found")
项目:zenchmarks    作者:squeaky-pl    | 项目源码 | 文件源码
def clientConnectionFailed(self, connector, reason):
        tkMessageBox.showwarning('TkConch','Connection Failed, Reason:\n %s: %s' % (reason.type, reason.value))
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def validate(self):
        try:
            result = self.getresult()
        except ValueError:
            messagebox.showwarning(
                "Illegal value",
                self.errormessage + "\nPlease try again",
                parent = self
            )
            return 0

        if self.minvalue is not None and result < self.minvalue:
            messagebox.showwarning(
                "Too small",
                "The allowed minimum value is %s. "
                "Please try again." % self.minvalue,
                parent = self
            )
            return 0

        if self.maxvalue is not None and result > self.maxvalue:
            messagebox.showwarning(
                "Too large",
                "The allowed maximum value is %s. "
                "Please try again." % self.maxvalue,
                parent = self
            )
            return 0

        self.result = result

        return 1
项目:stash-scanner    作者:senuido    | 项目源码 | 文件源码
def init_warn(self):
        warnings = ''
        if not len(cm.rates):
            warnings += 'Currency information is empty because the server returned no data. ' \
                        'Currency rates will be 0 unless set manually.\n'
        if not len(fm.autoFilters):
            warnings += 'Filters were not generated because the server returned no data.\n'

        if warnings:
            warnings += '\nYou can either continue in this mode or restart the application if you wish to try again.'
            messagebox.showwarning('Warning', warnings, parent=self)
项目:stash-scanner    作者:senuido    | 项目源码 | 文件源码
def stop_scan(self):
        self.btn_toggle.config(text="Stopping..", state=DISABLED)

        ls = LoadingScreen(self, determinate=False)
        threading.Thread(target=self._stop_scan, args=(ls,)).start()
        self.wait_window(ls)

        if self.stop_error:
            self.update_started()
            messagebox.showwarning('Operation timed out',
                                   "Stop request timed out. If the issue persists, restart the application.",
                                   parent=self)
        else:
            self.update_stopped()