Example #1
0
def checkWinner():
    if (button1['text'] == 'O' and button2['text'] == 'O'
            and button3['text'] == 'O' or button4['text'] == 'O'
            and button5['text'] == 'O' and button6['text'] == 'O'
            or button7['text'] == 'O' and button8['text'] == 'O'
            and button9['text'] == 'O' or button1['text'] == 'O'
            and button4['text'] == 'O' and button7['text'] == 'O'
            or button2['text'] == 'O' and button5['text'] == 'O'
            and button8['text'] == 'O' or button3['text'] == 'O'
            and button6['text'] == 'O' and button9['text'] == 'O'
            or button1['text'] == 'O' and button5['text'] == 'O'
            and button9['text'] == 'O' or button3['text'] == 'O'
            and button5['text'] == 'O' and button7['text'] == 'O'):
        messagebox._show("Winner Winner Chicken Dinner", "Player O is winner")

    if (button1['text'] == 'X' and button2['text'] == 'X'
            and button3['text'] == 'X' or button4['text'] == 'X'
            and button5['text'] == 'X' and button6['text'] == 'X'
            or button7['text'] == 'X' and button8['text'] == 'X'
            and button9['text'] == 'X' or button1['text'] == 'X'
            and button4['text'] == 'X' and button7['text'] == 'X'
            or button2['text'] == 'X' and button5['text'] == 'X'
            and button8['text'] == 'X' or button3['text'] == 'X'
            and button6['text'] == 'X' and button9['text'] == 'X'
            or button1['text'] == 'X' and button5['text'] == 'X'
            and button9['text'] == 'X' or button3['text'] == 'X'
            and button5['text'] == 'X' and button7['text'] == 'X'):
        messagebox._show("Winner Winner Chicken Dinner", "Player X is winner")
def check_haarcascadefile():
    exists = os.path.isfile("haarcascade_frontalface_default.xml")
    if exists:
        pass
    else:
        mess._show(title='Some file missing', message='Please contact us for help')
        window.destroy()
Example #3
0
def mabout():
    messagebox._show(
        title="About Me",
        _icon=None,
        message=
        " Name: Diptayan Biswas\n Email: [email protected]\n Codechef Handle: diptayan\n Codeforces Handle: kakarotto_sama\n Ratings:\n - 6* at Codechef\n - Expert at Codeforces"
    )
Example #4
0
def Cheack_Login():
    db = pymysql.connect(host='127.0.0.1',
                         port=3306,
                         user='******',
                         passwd='cla051063',
                         db='abes',
                         charset='utf8')
    cursor = db.cursor()
    global id1
    id1 = getid()
    sql = "SELECT id FROM user WHERE id='%s'" % (id1)
    cursor.execute(sql)
    result = cursor.fetchone()
    log = getlog()
    log1 = "login"
    if log1 == log:
        if result and log1 == log:
            db.close()
            print(id1)
            text1 = 'login'
            Cheack_Log(text1)
            Borrow_frame()
        else:
            msg._show(
                title='error!',
                message=
                'The user you entered does not exist! Please register first!')
    else:
        msg._show(title='error!', message='Please rescan the human face!')
def psw():
    label_reset()
    assure_path_exists("images\mfiles/")
    exists1 = os.path.isfile("images\mfiles\duinghr.db")
    if (not exists1):
        psd = tsd.askstring('Old Password not found', 'Please enter a new password below', show='*')
        if psd == None:
            mess._show(title='No Password Entered', message='Password not set!! Please try again')
            window.destroy
        conn = sqlite3.connect('images\mfiles\duinghr.db')
        c = conn.cursor()
        c.execute('CREATE TABLE IF NOT EXISTS Studentdetails(NAME TEXT)')
        c.execute("INSERT INTO StudentDetails VALUES (?)", (psd,))
        conn.commit()
        c.close()
        conn.close()
    else:
        conn = sqlite3.connect('images\mfiles\duinghr.db')
        c = conn.cursor()
        c.execute("SELECT * FROM StudentDetails")
        data = c.fetchall()
        data = data[0]
        key = data[0]
        c.close()
        conn.close()
    password = tsd.askstring('Password', 'Enter Password', show='*')
    window2.grab_set()
    if (password == key):
        saveprofile()
    elif (password == None):
        pass
    else:
        mess._show(title='Wrong Password', message='You have entered wrong password')
Example #6
0
def checkWinner():

    if (button1['text'] == 'O' and button2['text'] == 'O'
            and button3['text'] == 'O' or button4['text'] == 'O'
            and button5['text'] == 'O' and button6['text'] == 'O'
            or button7['text'] == 'O' and button8['text'] == 'O'
            and button9['text'] == 'O' or button1['text'] == 'O'
            and button4['text'] == 'O' and button7['text'] == 'O'
            or button2['text'] == 'O' and button5['text'] == 'O'
            and button8['text'] == 'O' or button3['text'] == 'O'
            and button6['text'] == 'O' and button9['text'] == 'O'
            or button1['text'] == 'O' and button5['text'] == 'O'
            and button9['text'] == 'O' or button3['text'] == 'O'
            and button5['text'] == 'O' and button7['text'] == 'O'):
        messagebox._show("Winner of Game", "Player O is the Winner")
        quit()

    elif (button1['text'] == 'X' and button2['text'] == 'X'
          and button3['text'] == 'X' or button4['text'] == 'X'
          and button5['text'] == 'X' and button6['text'] == 'X'
          or button7['text'] == 'X' and button8['text'] == 'X'
          and button9['text'] == 'X' or button1['text'] == 'X'
          and button4['text'] == 'X' and button7['text'] == 'X'
          or button2['text'] == 'X' and button5['text'] == 'X'
          and button8['text'] == 'X' or button3['text'] == 'X'
          and button6['text'] == 'X' and button9['text'] == 'X'
          or button1['text'] == 'X' and button5['text'] == 'X'
          and button9['text'] == 'X' or button3['text'] == 'X'
          and button5['text'] == 'X' and button7['text'] == 'X'):
        messagebox._show("Winner of Game", "Player X is the Winner")
        quit()
Example #7
0
def save_pass():
    assure_path_exists("TrainingImageLabel/")
    exists1 = os.path.isfile("TrainingImageLabel\psd.txt")
    if exists1:
        tf = open("TrainingImageLabel\psd.txt", "r")
        key = tf.read()
    else:
        master.destroy()
        new_pas = tsd.askstring('ไม่พบรหัสผ่านเก่า', 'โปรดป้อนรหัสผ่านใหม่ด้านล่าง', show='*')
        if new_pas == None:
            mess._show(title='ไม่ได้ใส่รหัสผ่าน', message='ยังไม่ได้กำหนดรหัสผ่าน!! กรุณาใส่ใหม่')
        else:
            tf = open("TrainingImageLabel\psd.txt", "w")
            tf.write(new_pas)
            mess._show(title='รหัสผ่านลงทะเบียน', message='ลงทะเบียนรหัสผ่านใหม่เรียบร้อยแล้ว !!')
            return
    op = (old.get())
    newp= (new.get())
    nnewp = (nnew.get())
    if (op == key):
        if(newp == nnewp):
            txf = open("TrainingImageLabel\psd.txt", "w")
            txf.write(newp)
        else:
            mess._show(title='ผิดพลาด', message='ยืนยันรหัสผ่านใหม่อีกครั้ง !!!')
            return
    else:
        mess._show(title='รหัสผ่านผิด', message='กรุณากรอกรหัสผ่านเดิมให้ถูกต้อง')
        return
    mess._show(title='เปลี่ยนรหัสผ่านแล้ว', message='เปลี่ยนรหัสผ่านเรียบร้อย !!')
    master.destroy()
Example #8
0
def naruci():
    odgovor = ""
    flag = False
    velicina = ""
    vrsta = ""
    b=""
    nacinPlacanja=""
    if varVelicina.get()==1:
        velicina = "25cm"
    elif varVelicina.get()==2:
        velicina = "32cm"
    elif varVelicina.get()==3:
        velicina = "50cm"
    if varVrsta.get()==1:
        vrsta="Margarita"
    elif varVrsta.get()==2:
        vrsta="Quattro Stagione"
    elif varVrsta.get()==3:
        vrsta="Funghi"
    elif varVrsta.get()==4:
        vrsta = "Vegeteriana"
    if varKecap.get():
        b = "sa kecapom,"
    c=""
    if varMajonez.get():
        c = "sa majonezom,"
    d=""
    if varOrigano.get():
        d = "sa origanom,"

    izbor =c+b+d
    if varNacin.get()==1:
        nacinPlacanja = "placanje gotovinom"
    if varNacin.get()==2:
        nacinPlacanja="placanje karticom"


    print(varTelefon.get())
    regex = "\w{3}-\w{4}-\w{3}"

    if not re.search(regex,varTelefon.get()):
        txtTelefon.configure(bg="red")
        txtTelefon.update()
        messagebox._show("Greska pri unosu!","Broj telefona mora biti u formatu 000-0000-000")
        flag = False
    else:
        flag=True

    if varAdresa.get()=="" or varTelefon.get()=="":
        messagebox._show("Greska!","Polja za unos adrese i broja telefona moraju biti popunjena!")
        flag=False


    if flag==True:
        porudzbina = "Pica: " + velicina + ", " + vrsta + ", " + izbor + nacinPlacanja + ", " + varAdresa.get() + ", " + varTelefon.get() + ", " + varNapomena.get()
        messagebox.showinfo("Narudžba", "Naručili ste: " + velicina +", " + vrsta + ", " +izbor + nacinPlacanja + ", " + varAdresa.get() + ", " + varTelefon.get() + ", " + varNapomena.get())
        print(porudzbina)
        s.send(porudzbina.encode())
        odgovor = s.recv(1024).decode()
        lblVreme.config(text=odgovor + "minuta")
Example #9
0
 def change_req(self, flag):
     if (self.old.get() == '' or self.new.get() == ''
             or self.confirm.get() == ''):
         messagebox._show('Intente llenar todos los campos')
     else:
         self.fetch()
         self.details = self.conn.execute(
             'Select nom_dueño, pass, id_cuenta, tipo, balance, estado from cuenta where id_cuenta = ?',
             (self.ac, ))
         for i in self.details:
             p = i[1]
         if self.old.get() == p:
             if self.new.get() == self.confirm.get():
                 self.limpiar = Label(self.frame,
                                      text='',
                                      font=('Courier', 20, 'bold'))
                 self.limpiar.place(x=140, y=180, width=380, height=180)
                 self.label = Label(self.frame,
                                    text='Pin actualizado',
                                    font=('Courier', 10, 'bold'))
                 self.label.place(x=180, y=180, width=300, height=100)
                 self.conn.execute(
                     'Update cuenta set pass = ? where id_cuenta=?',
                     (self.new.get(), self.ac))
                 self.conn.commit()
                 self.remove_change_pin()
                 messagebox._show('Reinicio', 'Vuelva a ingresar')
                 main.destroy()
Example #10
0
def check_haarcascadefile():
    exists = os.path.isfile("haarcascade_frontalface_default.xml")
    if exists:
        pass
    else:
        mess._show(title='หาไฟล์เปรียบเทียบใบหน้าไม่เจอ', message='กรุณาติดต่อที่เบอร์ 01-23456789')
        window.destroy()
def iptalGoster():
    adEntryVeri = adEntry.get()
    if adEntryVeri != "":
        msg._show("İptal", "İptal Butonuna Basıldı")
        adEntry.delete(0, END)
    else:
        msg._show("İptal", "İptal Butonuna Basıldı")
Example #12
0
 def with_trans(self, flag):
     if (self.amount.get() == ''):
         d = 'Enter amount'
         messagebox._show('Transaction Error', d)
     elif (self.amo < int(self.amount.get())):
         d = 'Monto supera el balance de la cuenta'
         messagebox._show('Error transaccional', d)
     else:
         self.limpiar = Label(self.frame,
                              text='',
                              font=('Courier', 20, 'bold'))
         self.limpiar.place(x=140, y=180, width=380, height=180)
         self.label = Label(self.frame,
                            text='Transaccion exitosa',
                            font=('Courier', 10, 'bold'))
         self.label.place(x=180, y=180, width=300, height=100)
         self.conn.execute(
             'Update cuenta set balance = balance-? where id_cuenta=?',
             (self.amount.get(), self.ac))
         self.conn.execute(
             'Insert into transaccion (descripcion , estado , fecha , id_Cajero , id_Cuenta, monto) values ("Retiro","aprobado","02/02/2021",1000, ? , ?)',
             (self.ac, self.amount.get()))
         self.conn.commit()
         self.last_with()
         self.entries()
         self.fetch()
Example #13
0
def mabout():
    messagebox._show(
        title="About Me",
        _icon=None,
        message=
        " Name: Pratik Lath\n Email: [email protected]\n Codechef Handle: pratiklath\n Codeforces Handle: pratiklath\n Ratings:\n - 5* at Codechef\n - Expert at Codeforces"
    )
def save_pass():
    assure_path_exists("TrainingImageLabel/")
    exists1 = os.path.isfile("TrainingImageLabel\psd.txt")
    if exists1:
        tf = open("TrainingImageLabel\psd.txt", "r")
        key = tf.read()
    else:
        master.destroy()
        new_pas = tsd.askstring('Old Password not found', 'Please enter a new password below', show='*')
        if new_pas == None:
            mess._show(title='No Password Entered', message='Password not set!! Please try again')
        else:
            tf = open("TrainingImageLabel\psd.txt", "w")
            tf.write(new_pas)
            mess._show(title='Password Registered', message='New password was registered successfully!!')
            return
    op = (old.get())
    newp= (new.get())
    nnewp = (nnew.get())
    if (op == key):
        if(newp == nnewp):
            txf = open("TrainingImageLabel\psd.txt", "w")
            txf.write(newp)
        else:
            mess._show(title='Error', message='Confirm new password again!!!')
            return
    else:
        mess._show(title='Wrong Password', message='Please enter correct old password.')
        return
    mess._show(title='Password Changed', message='Password changed successfully!!')
    master.destroy()
Example #15
0
def checkwinner():
    if (button1['text'] == 'O' and button2['text'] == 'O'
            and button3['text'] == 'O' or button4['text'] == 'O'
            and button5['text'] == 'O' and button6['text'] == 'O'
            or button7['text'] == 'O' and button8['text'] == 'O'
            and button9['text'] == 'O' or button1['text'] == 'O'
            and button4['text'] == 'O' and button7['text'] == 'O'
            or button2['text'] == 'O' and button5['text'] == 'O'
            and button8['text'] == 'O' or button3['text'] == 'O'
            and button6['text'] == 'O' and button9['text'] == 'O'
            or button1['text'] == 'O' and button5['text'] == 'O'
            and button9['text'] == 'O' or button3['text'] == 'O'
            and button5['text'] == 'O' and button7['text'] == 'O'):
        messagebox._show("Winner is", " PLAYER-O ")

    elif (button1['text'] == 'X' and button2['text'] == 'X'
          and button3['text'] == 'X' or button4['text'] == 'X'
          and button5['text'] == 'X' and button6['text'] == 'X'
          or button7['text'] == 'X' and button8['text'] == 'X'
          and button9['text'] == 'X' or button1['text'] == 'X'
          and button4['text'] == 'X' and button7['text'] == 'X'
          or button2['text'] == 'X' and button5['text'] == 'X'
          and button8['text'] == 'X' or button3['text'] == 'X'
          and button6['text'] == 'X' and button9['text'] == 'X'
          or button1['text'] == 'X' and button5['text'] == 'X'
          and button9['text'] == 'X' or button3['text'] == 'X'
          and button5['text'] == 'X' and button7['text'] == 'X'):
        messagebox._show("Winner is", " PLAYER-X ")
Example #16
0
    def mostrar(self):
        """ Metodo que muestra registros existentes en base de datos """
        try:
            # limpieza de tabla
            records = self.tree.get_children()
            for element in records:
                self.tree.delete(element)

            # Consiguiendo datos
            sql_select = 'SELECT * FROM producto ORDER BY id ASC'
            mibase = mysql.connector.connect(host="localhost",
                                             user="******",
                                             passwd="",
                                             database="base_luciano3")
            micursor = mibase.cursor()
            micursor.execute(sql_select)
            resultado = micursor.fetchall()

            for fila in resultado:
                self.tree.insert('',
                                 0,
                                 text=fila[0],
                                 values=(fila[1], fila[2]))
        except:
            messagebox._show(message="Aún no se ha creado una bd")
Example #17
0
def checkWinner():
    if (button1['text'] == '0' and button2['text'] == '0'
            and button3['text'] == '0' or button4['text'] == '0'
            and button5['text'] == '0' and button6['text'] == '0'
            or button7['text'] == '0' and button8['text'] == '0'
            and button9['text'] == '0' or button1['text'] == '0'
            and button4['text'] == '0' and button7['text'] == '0'
            or button2['text'] == '0' and button5['text'] == '0'
            and button8['text'] == '0' or button3['text'] == '0'
            and button6['text'] == '0' and button9['text'] == '0'
            or button1['text'] == '0' and button5['text'] == '0'
            and button9['text'] == '0' or button3['text'] == '0'
            and button5['text'] == '0' and button7['text'] == '0'):
        messagebox._show("Winnerof Game....*-*", "Player 0 is Winner")

    elif (button1['text'] == 'X' and button2['text'] == 'X'
          and button3['text'] == 'X' or button4['text'] == 'X'
          and button5['text'] == 'X' and button6['text'] == 'X'
          or button7['text'] == 'X' and button8['text'] == 'X'
          and button9['text'] == 'X' or button1['text'] == 'X'
          and button4['text'] == 'X' and button7['text'] == 'X'
          or button2['text'] == 'X' and button5['text'] == 'X'
          and button8['text'] == 'X' or button3['text'] == 'X'
          and button6['text'] == 'X' and button9['text'] == 'X'
          or button1['text'] == 'X' and button5['text'] == 'X'
          and button9['text'] == 'X' or button3['text'] == 'X'
          and button5['text'] == 'X' and button7['text'] == 'X'):
        messagebox._show("Winnerof Game....*-*", "Player X is Winner")
Example #18
0
def clientes():
    banco()
    clientes.delete(*clientes.get_children())
    lista = cursor.execute('SELECT * FROM clientes')
    for data in lista:
        clientes.insert('', END, values=(data))
    messagebox._show('MorenoNet', 'Dados Carregados e Atualizados!')
Example #19
0
def check_book():
    db = pymysql.connect("localhost", "root", "root", "library")
    cursor = db.cursor()
    a = input_book.get()
    sql = "SELECT * FROM book WHERE bname = '%s'" % (a)
    cursor.execute(sql)
    results = cursor.fetchone()
    if results:
        root3 = tk.Tk()
        root3.title('查询到的书')
        val = "您要查询的书号为:%s" % (results[0])
        print2 = tk.Label(root3, text=val)
        print2.grid(row=1, column=0, padx=10, pady=5)
        val = "您要查询的书的作者为:%s" % (results[1])
        print3 = tk.Label(root3, text=val)
        print3.grid(row=2, column=0, padx=10, pady=5)
        val = "您要查询的书的库存量为:%s" % (results[2])
        print4 = tk.Label(root3, text=val)
        print4.grid(row=3, column=0, padx=10, pady=5)
        val = "您要查询的书名为:%s" % (results[3])
        print5 = tk.Label(root3, text=val)
        print5.grid(row=4, column=0, padx=10, pady=5)
        val = "您要查询的书的出版日期为:%s" % (results[4])
        print6 = tk.Label(root3, text=val)
        print6.grid(row=5, column=0, padx=10, pady=5)
    else:
        msg._show(title='错误', message='没有查到您要查询的记录')
    db.close()
Example #20
0
                def btnadd():
                    b = bidE.get()
                    ba = btitleE.get()
                    bb = bauthorE.get()
                    bc = byearE.get()
                    bd = bsubjectE.get()
                    be = bavicopiesE.get()
                    bf = btotalcopiesE.get()

                    db = pymysql.connect(host="localhost",
                                         user="******",
                                         password="******",
                                         db="test")
                    cursor = db.cursor()

                    ins_book = (
                        "INSERT  INTO test.book_tbl(BookId,Title,Author,Year,Subject,AvailableCopies,TotalCopies) VALUES("
                        + b + ",' " + ba + " ',' " + bb + " ', " + bc +
                        " ,' " + bd + " '," + be + "," + bf + ");")

                    cursor.execute(ins_book)

                    ms._show("Book ADD", "Successfully Added")

                    db.commit()
                    db.close()

                    if result:
                        print("successfull")

                    else:
                        print("nhi hua")
Example #21
0
    def add():

        name = e1.get()
        pswd = e2.get()

        db = pymysql.connect(host="localhost",
                             user="******",
                             password="******",
                             db="test")
        cursor = db.cursor()

        find_user = ("INSERT  INTO test.login(username,passwords) VALUES(' " +
                     name + " '," + pswd + ");")

        # find_user = ("DELETE FROM test.login WHERE username = '******';")

        # find_user = ("UPDATE test.login set passwords = 123456789 where username = '******';")

        cursor.execute(find_user)

        ms._show("Signup", "Successfully Added")

        # print("DATA DELETED")

        # print("Data UPDATED")

        db.commit()
        db.close()
Example #22
0
def checkWinner():
    if (button1['text'] == 'X' and button2['text'] == 'X'
            and button3['text'] == 'X' or button4['text'] == 'X'
            and button5['text'] == 'X' and button6['text'] == 'X'
            or button7['text'] == 'X' and button8['text'] == 'X'
            and button9['text'] == 'X' or button1['text'] == 'X'
            and button4['text'] == 'X' and button7['text'] == 'X'
            or button2['text'] == 'X' and button5['text'] == 'X'
            and button8['text'] == 'X' or button3['text'] == 'X'
            and button6['text'] == 'X' and button9['text'] == 'X'
            or button1['text'] == 'X' and button5['text'] == 'X'
            and button9['text'] == 'X' or button3['text'] == 'X'
            and button5['text'] == 'X' and button7['text'] == 'X'):
        disableButton()
        messagebox._show('Winner', p1.get())

    if (button1['text'] == 'O' and button2['text'] == 'O'
            and button3['text'] == 'O' or button4['text'] == 'O'
            and button5['text'] == 'O' and button6['text'] == 'O'
            or button7['text'] == 'O' and button8['text'] == 'O'
            and button9['text'] == 'O' or button1['text'] == 'O'
            and button4['text'] == 'O' and button7['text'] == 'O'
            or button2['text'] == 'O' and button5['text'] == 'O'
            and button8['text'] == 'O' or button3['text'] == 'O'
            and button6['text'] == 'O' and button9['text'] == 'O'
            or button1['text'] == 'O' and button5['text'] == 'O'
            and button9['text'] == 'O' or button3['text'] == 'O'
            and button5['text'] == 'O' and button7['text'] == 'O'):
        disableButton()
        messagebox._show('Winner ', p2.get())
Example #23
0
def id_check(a):
    global id
    if a == '1':
        id = manager.entry_name.get()
        password = manager.entry_key.get()
    else:
        id = borrower.entry_name.get()
        password = borrower.entry_key.get()
    getid()
    db = pymysql.connect(host='127.0.0.1',
                         port=3306,
                         user='******',
                         passwd='cla051063',
                         db='abes',
                         charset='utf8')
    cursor = db.cursor()
    sql = "SELECT password FROM user WHERE id='%s' AND job='%s'" % (id, a)
    cursor.execute(sql)
    result = cursor.fetchone()
    if result:
        if password == result[0]:
            success_login(a)
        else:
            msg._show(title='error!',
                      message='Wrong account or password input!')
    else:
        msg._show(
            title='error!',
            message=
            'The user you entered does not exist! Please register first!')
        if a == '1':
            manager.root1.destroy()
        elif a == '0':
            borrower.root1.destroy()
    db.close()  #
Example #24
0
    def AddToFile():

        # check for invalid input
        try:
            eval(salary.get())
            if (name.get() == ""):
                raise ValueError('Invalid Input')
            if (department.get() == ""):
                raise ValueError('Invalid Input')
            if (designation.get() == ""):
                raise ValueError('Invalid Input')
            if (status.get() == ""):
                raise ValueError('Invalid Input')
        except:
            messagebox._show(
                "Invalid Input",
                "Please enter valid inputs. Closing this window.")
            root.destroy()

        # adding details to list
        details.append(name.get() + "\n")
        details.append(department.get() + "\n")
        details.append(designation.get() + "\n")
        details.append(status.get() + "\n")
        details.append(str(eval(salary.get())) + "\n")

        with open('db.txt', 'a') as output:  # opens file in append mode
            output.writelines(details)  # print list to  file
        messagebox.showinfo("Successful!", "New Record is added successfully!"
                            )  # operation done successfully message
        root.destroy()
def check():
    if (button1['text'] == 'O' and button2['text'] == 'O' and button3['text'] == 'O' or
        button4['text'] == 'O' and button5['text'] == 'O' and button6['text'] == 'O' or
        button7['text'] == 'O' and button8['text'] == 'O' and button9['text'] == 'O' or
        button4['text'] == 'O' and button5['text'] == 'O' and button6['text'] == 'O' or
        button1['text'] == 'O' and button4['text'] == 'O' and button7['text'] == 'O' or
        button2['text'] == 'O' and button5['text'] == 'O' and button8['text'] == 'O' or
        button3['text'] == 'O' and button6['text'] == 'O' and button9['text'] == 'O' or
        button1['text'] == 'O' and button5['text'] == 'O' and button9['text'] == 'O' or
        button3['text'] == 'O' and button5['text'] == 'O' and button7['text'] == 'O'):


        messagebox._show("CONGRATS", "{} is the winner".format(entry1.get()))

    elif (button1['text'] == 'X' and button2['text'] == 'X' and button3['text'] == 'X' or
        button4['text'] == 'X' and button5['text'] == 'X' and button6['text'] == 'X' or
        button7['text'] == 'X' and button8['text'] == 'X' and button9['text'] == 'X' or
        button4['text'] == 'X' and button5['text'] == 'X' and button6['text'] == 'X' or
        button1['text'] == 'X' and button4['text'] == 'X' and button7['text'] == 'X' or
        button2['text'] == 'X' and button5['text'] == 'X' and button8['text'] == 'X' or
        button3['text'] == 'X' and button6['text'] == 'X' and button9['text'] == 'X' or
        button1['text'] == 'X' and button5['text'] == 'X' and button9['text'] == 'X' or
        button3['text'] == 'X' and button5['text'] == 'X' and button7['text'] == 'X'):


        messagebox._show("CONGRATS","{} is the winner".format(entry2.get()))
Example #26
0
def id_check(a):  # 检查账号
    global id
    if a == '1':  # 在管理员界面下登录,参数是1
        # 把账号/密码框框里输入的字符串赋值给id/password
        id = manager.entry_name.get()
        password = manager.entry_key.get()
    else:  # 在读者界面下登录,参数是0
        id = reader.entry_name.get()
        password = reader.entry_key.get()
    getid()  # 最后得到id
    # 连接数据库,root是你数据库的用户名,应该是默认的是root,sunhao2268411762是你数据库的密码,library是你要连接的数据库名字
    db = pymysql.connect("localhost", "root", "sunhao2268411762", "library")
    # 建立游标cursor,这个游标可以类比指针,这样理解比较直观
    cursor = db.cursor()
    sql = "SELECT password FROM user WHERE id='%s' AND job='%s'" % (id, a)
    cursor.execute(sql)  # sql语句被执行
    result = cursor.fetchone()  # 得到的结果返回给result数组
    if result:  # 如果查询到了账号存在
        if password == result[0]:  # result[0]是数组中的第一个结果
            success_login(a)  # 密码对上了,进入对应的读者/管理员操作界面
        else:  # 有账号但密码没对上
            msg._show(title='错误!', message='账号或密码输入错误!')
    else:  # 没有账号
        msg._show(title='错误!', message='您输入的用户不存在!请先注册!')
        if a == '1':
            manager.root1.destroy()  # 关闭登录小窗口,回到管理员界面
        elif a == '0':
            reader.root1.destroy()
    db.close()  # 查询完一定要关闭数据库啊
Example #27
0
 def ymlmanip(self):
     if sys.platform == 'win32':
         ymloperations.Ymloperations().upload()
         messagebox._show("Success!", "Model uploaded successfully")
     else:
         ymloperations.Ymloperations().download()
         messagebox._show("Success!", "Model downloaded successfully")
Example #28
0
    def compare_set(self):
        arrTargetCard = self.find_match()

        if arrTargetCard == self.arrCard3:
            messagebox._show(title="Set", message="Set!")
        else:
            messagebox._show(title="Set", message="WRONG.")
Example #29
0
def Copy():
    password = entry.get()
    if (len(password) != 0):
        pyperclip.copy(password)
        msgbox._show(title="Copied", message="Password Copied to clipboard")
    else:
        msgbox.showwarning(title="Empty", message="First Generate a password")
def add(b_id, p_id, num, month, day):  #添加图书信息到数据库中
    #sql="INSERT INTO book VALUES('%s','%s','%s','%s','%s')"% (list.get(),b_name.get(),author.get(),price.get(),amount.get())
    db = pymysql.connect("localhost", user_name, pass_word, "booksell")
    cursor = db.cursor()
    #cursor.execute(sql)

    cursor.execute(
        'select count,price from book,supplier where book_id = book.id and book.id = '
        + b_id.get() + ' and supplier.id = ' + p_id.get())
    res = cursor.fetchone()
    rest_num = res[0]
    price_in = res[1]
    #print(rest_num+int(num.get()),price_in)

    try:
        cursor.execute("start transaction")

        cursor.execute("update book set count = " +
                       str(rest_num + int(num.get())) + ', price_in = ' +
                       str(price_in) + ', price_out=' +
                       str(format(1.2 * float(price_in), '.2f')) +
                       'where id = ' + b_id.get())

        # 添加进货记录
        cursor.execute('select num from purchase where id =' + b_id.get() +
                       ' and month=' + month.get() + ' and day=' + day.get() +
                       ' and supplier_id=' + p_id.get())
        record_num = cursor.fetchone()
        #print(record_num)
        # 如果没有当天的进货记录则创建新的进货记录
        if record_num == ():
            #print(1)
            cursor.execute("insert into purchase values(" + b_id.get() + ',' +
                           month.get() + ',' + day.get() + ',' + num.get() +
                           ',' + p_id.get() + ")")

        # 否则直接修改当天的进货记录
        else:
            if record_num[0] + int(num.get()) == 0:
                #print(2)
                cursor.execute("delete from purchase where id=" + b_id.get() +
                               " and month=" + month.get() + " and day=" +
                               day.get() + " and supplier_id=" + p_id.get())

            else:
                #print(3)
                cursor.execute("update purchase set num=" +
                               str(record_num[0] + int(num.get())) +
                               " where id=" + b_id.get() + " and month=" +
                               month.get() + " and day=" + day.get() +
                               " and supplier_id=" + p_id.get())

    except:
        msg._show(title='错误!', message='数据库查询出错!')
        cursor.execute("rollback")  # 出错时需要回滚

    db.commit()  #这句不可或缺,当我们修改数据完成后必须要确认才能真正作用到数据库里

    db.close()
    msg.showinfo(title='成功!', message='新书已入库!')
Example #31
0
 def CheckLoss(self):
     '''Checks if player lost'''
     self.loser = True
     self.flagTrack['text'] = '0'
     messagebox._show('Minesweeper', 'You Lose!', parent=self)
     for key in self.cells.keys():
         if self.cells[key].value == 9:
             self.cells[key].flagged = False
             self.cells[key].expose()
     playagain()
Example #32
0
def readConfig():
	if platform.system() == "Windows":
		try:
			theconfigFile = open('config\\clients.config', 'r')
		except:
			window = Tk()
			window.withdraw()
			createFolder("config\\")
			File = open('config\\clients.config', 'a')
			File.close()
			messagebox.showinfo("Missing config", "No config Found. Createt an empty one")
			window.destroy()
			return
	else:
		try:
			theconfigFile = open('config/clients.config', 'r')
		except:
			window = Tk()
			window.withdraw()
			createFolder("config/")
			File = open('config/clients.config', 'a')
			File.close()
			messagebox._show("Missing config", "No config Found. Created an empty one")
			window.destroy()
			return
	theConfig = theconfigFile.read().splitlines()
	theconfigFile.close()
	for line in theConfig:
		if line[0] != " ":
			phase=0
			name=""
			for char in line:
				if char=='[' and phase==0:
					phase=1
				elif char != ']':
					name=name+char
			createGroup(name)
			gID = len(theGroup)-1
		else:
			theName = ""
			theAdress = ""
			phase = 0
			for buchstabe in line:
				if buchstabe != " " and phase == 0:
					if buchstabe == ":":
						phase = 1
					else:
						theName = theName + buchstabe
				elif buchstabe != " " and phase == 1:
					theAdress = theAdress + buchstabe
			addGroupClient(groupID=gID,clientName=theName,clientAddress=theAdress)
Example #33
0
 def readConfig(self):
     global gID, gID
     if platform.system() == "Windows":
         try:
             theconfigFile = open('config\\clients.config', 'r')
         except:
             window = Tk()
             window.withdraw()
             self.createFolder("config\\")
             File = open('config\\clients.config', 'a')
             File.close()
             messagebox.showinfo(
                 "Missing config", "No config Found. Createt an empty one")
             window.destroy()
             return
     else:
         try:
             theconfigFile = open('config/clients.config', 'r')
         except:
             window = Tk()
             window.withdraw()
             self.createFolder("config/")
             File = open('config/clients.config', 'a')
             File.close()
             messagebox._show("Missing config",
                              "No config Found. Created an empty one")
             window.destroy()
             return
     theConfig = theconfigFile.read().splitlines()
     theconfigFile.close()
     for line in theConfig:
         if line[0] != " ":
             gID = self.createGroup(line) - 1
         else:
             theName = ""
             theAdress = ""
             phase = 0
             for buchstabe in line:
                 if buchstabe != " " and phase == 0:
                     if buchstabe == ":":
                         phase = 1
                     else:
                         theName = theName + buchstabe
                 elif buchstabe != " " and phase == 1:
                     theAdress = theAdress + buchstabe
             self.addGroupClient(gID, theName, theAdress)
Example #34
0
    def updateGUI(self):

        list2 = self.find()
        for item in list2:
            y = item[0]
            x = item[1]
            tuple = (y,x)

            label = self.aDict[tuple]
            label.configure(background = 'yellow')
            label.configure(fg ='grey')

        entry = self.e3.get()
        if len(entry) == 3:
            if '=-+*/'.find(entry[0]) == -1 and '=-+*/'.find(entry[2]) == -1:
                value = eval(entry)
            else:
                value = False
        else:
            messagebox.showwarning(title = 'Invalid input', message = 'Invalid Input')
            value = False
        y = 0
        counter = 0
        for x in self.rows2:
            if value == False:
                searchNum = True
            else:
                searchNum = int(x[0])

            print ( searchNum , 'SearchNum')
            print ( counter, 'Counter')
            if value == searchNum:
                label = self.searchables[counter]
                label.configure(fg = 'grey')
                print ( 'label changed!')
                if self.booleans[counter] == False:
                    self.booleans[counter] = True
                    y += 1
                if y == 8:
                    messagebox._show(title = 'congrats', message = ' You have found all the nums!' )
                if counter != 9:
                    counter += 1
            else:
                print ('not a match!')
                counter += 1
Example #35
0
def load_intro():
    with open("./intro/intro.txt") as f:
        data = f.read()
    if [ c for c in data if c not in ('o','*','\n')] or len(data) > 1125:
        warn = messagebox._show("Bad format","You messed up the intro pattern")
    else:
        for i in range(len(data)):
            if data[i] == "*":
                Cell.cells[i].is_alive = True
                Cell.cells[i].draw_life()
Example #36
0
def load_preset():
    """
    Loading preset pattern in plaintext from filesystem
    """
    with open("./presets/{}".format(preset_var.get() ) ) as f:
        data = f.read()
    allowed_chars = ('o','*','\n')
    if [c for c in data if c not in allowed_chars] or len(data) > 1125:
        warn = messagebox._show("Bad format","File format is invalid, it should be \nmade of 1125 chars containing 'o' or '*'")

    else:
        for i in range(len(data)):
            if data[i] == "*":
                Cell.cells[i].is_alive = True
                Cell.cells[i].draw_life()