def makesure(skin):
    def delt():
        cv2.destroyWindow("frame")
        cv2.destroyWindow("RESULT")
        root2.destroy()
    def suss():
        save()
        cv2.destroyWindow("frame")
        cv2.destroyWindow("RESULT")
        root2.destroy()
    root2 = Tk() # 初始化Tk()
    root2.title("INDEX")    # 设置窗口标题
    root2.geometry("400x400")    # 设置窗口大小 注意:是x 不是*
    root2.resizable(width=True, height=True) # 设置窗口是否可以变化长/宽,False不可变,True可变,默认为True
    root2.tk.eval('package require Tix')  #引入升级包,这样才能使用升级的组合控件

    lable = Label(root2, text="Do u want to save the result pic?", bg="blue",bd=10, font=("Arial",12), width=30, height=3)
    lable.pack(side=TOP)

    button=Button(root2,text='Confirm',command=suss,activeforeground="black",activebackground='blue',bg='green',fg='white')
    button.pack(side=BOTTOM)

    button=Button(root2,text='Delete',command=delt,activeforeground="black",activebackground='blue',bg='red',fg='white')
    button.pack(side=BOTTOM)

    cv2.namedWindow("RESULT", cv2.WINDOW_GUI_EXPANDED)
    cv2.imshow("RESULT",skin)

    root2.mainloop()
示例#2
0
from tkinter import *
from tkinter.tix import Tk, Control, ComboBox  #升级的组合控件包
from tkinter.messagebox import showinfo, showwarning, showerror  #各种类型的提示框

root = Tk()  # 初始化Tk()
root.title("hello tkinter")  # 设置窗口标题
root.geometry("800x1000")  # 设置窗口大小 注意:是x 不是*
root.resizable(width=True,
               height=True)  # 设置窗口是否可以变化长/宽,False不可变,True可变,默认为True
root.tk.eval('package require Tix')  #引入升级包,这样才能使用升级的组合控件

lable = Label(root,
              text="label",
              bg="pink",
              bd=10,
              font=("Arial", 12),
              width=8,
              height=3)
lable.pack(side=LEFT)

# Booleans
NO = FALSE = OFF = 0
YES = TRUE = ON = 1

# -anchor and -sticky
N = 'n'
S = 's'
W = 'w'
E = 'e'
NW = 'nw'
SW = 'sw'
示例#3
0
def final_page(hint, time):

    root = Tk()
    root.title("A Compressed Software By Wang,Xu,Wu,Huang")
    root.geometry("999x666")
    root.resizable(width=True, height=True)
    root.eval('package require Tix')
    root['bg'] = '#FFFAF0'

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=480)

    text1 = Label(root,
                  text=hint,
                  bg="#FFFAF0",
                  fg="BLACK",
                  font=("黑体", 10),
                  width=100,
                  height=2,
                  anchor="center")
    text1.place(x=100, y=300)

    text2 = Label(root,
                  text="程序运行时间:",
                  bg="#FFFAF0",
                  fg="BLACK",
                  font=("黑体", 10),
                  width=100,
                  height=2,
                  anchor="center")
    text2.place(x=100, y=380)

    text3 = Label(root,
                  text=time,
                  bg="#FFFAF0",
                  fg="BLACK",
                  font=("黑体", 10),
                  width=100,
                  height=2,
                  anchor="center")
    text3.place(x=300, y=380)

    text4 = Label(root,
                  text="s",
                  bg="#FFFAF0",
                  fg="BLACK",
                  font=("黑体", 10),
                  width=3,
                  height=2,
                  anchor="center")
    text4.place(x=730, y=380)

    button1_3 = Button(root,
                       text="Return",
                       font=("宋体", 15),
                       command=lambda: location_page(root),
                       width=5,
                       height=1,
                       bg="#48D1CC")
    button1_3.place(x=780, y=600)

    button1_4 = Button(root,
                       text="Exit",
                       font=("宋体", 15),
                       command=lambda: sys.exit(),
                       width=5,
                       height=1,
                       bg="#20B2AA")
    button1_4.place(x=860, y=600)

    root.mainloop()
示例#4
0
def location_page(root_function_or_final):
    global File_location
    File_location = "null"

    root_function_or_final.destroy()

    root = Tk()
    root.title("A Compressed Software By Wang,Xu,Wu,Huang")
    root.geometry("999x666")
    root.resizable(width=True, height=True)
    root.eval('package require Tix')
    root['bg'] = '#FFFAF0'
    text1 = Label(
        root,
        text="-⭐-Input The Location Of File You Want To Deal With-⭐-",
        bg="#FFFAF0",
        fg="BLACK",
        font=("黑体", 20),
        width=70,
        height=2,
        anchor="center")
    text1.place(x=10, y=40)
    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=480)

    location_input = StringVar()
    location_input = Entry(root, bg="#ADD8E6", width=100)
    location_input.place(x=100, y=330)

    button1_3 = Button(root,
                       text="Start",
                       font=("宋体", 10),
                       command=lambda: get_location(root, location_input),
                       width=5,
                       height=1,
                       bg="#AFEEEE")
    button1_3.place(x=866, y=330)

    button1_3 = Button(root,
                       text="Return",
                       font=("宋体", 15),
                       command=lambda: function_page(root),
                       width=5,
                       height=1,
                       bg="#48D1CC")
    button1_3.place(x=780, y=600)

    button1_4 = Button(root,
                       text="Exit",
                       font=("宋体", 15),
                       command=lambda: sys.exit(),
                       width=5,
                       height=1,
                       bg="#20B2AA")
    button1_4.place(x=860, y=600)

    root.mainloop()
示例#5
0
def function_page(root_main_or_ocation):
    global Function_choice
    Function_choice = 0

    root_main_or_ocation.destroy()

    root = Tk()
    root.title("A Compressed Software By Wang,Xu,Wu,Huang")
    root.geometry("999x666")
    root.resizable(width=True, height=True)
    root.eval('package require Tix')
    root['bg'] = '#FFFAF0'
    text1 = Label(root,
                  text="-⭐-Compress Or Uncompress-⭐-",
                  bg="#FFFAF0",
                  fg="BLACK",
                  font=("黑体", 25),
                  width=50,
                  height=2,
                  anchor="center")
    text1.place(x=70, y=40)
    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=480)

    button1_1 = Button(root,
                       text="Compress",
                       font=("宋体", 30),
                       command=lambda: function(1, root),
                       width=15,
                       height=2,
                       bg="#87CEEB")
    button1_1.place(x=150, y=300)

    button1_2 = Button(root,
                       text="Uncompress",
                       font=("宋体", 30),
                       command=lambda: function(2, root),
                       width=15,
                       height=2,
                       bg="#4682B4")
    button1_2.place(x=550, y=300)

    button1_3 = Button(root,
                       text="Return",
                       font=("宋体", 15),
                       command=lambda: main_page(root),
                       width=5,
                       height=1,
                       bg="#48D1CC")
    button1_3.place(x=780, y=600)

    button1_4 = Button(root,
                       text="Exit",
                       font=("宋体", 15),
                       command=lambda: sys.exit(),
                       width=5,
                       height=1,
                       bg="#20B2AA")
    button1_4.place(x=860, y=600)

    root.mainloop()
示例#6
0
def main_page(root_function):
    global Algorithm_choice
    Algorithm_choice = 0

    root_function.destroy()

    root = Tk()
    root.title("A Compressed Software By Wang,Xu,Wu,Huang")
    root.geometry("999x666")
    root.resizable(width=True, height=True)
    root.eval('package require Tix')
    root['bg'] = '#FFFAF0'
    text1 = Label(root,
                  text="-⭐-Choose the compressed algorithm you want-⭐-",
                  bg="#FFFAF0",
                  fg="BLACK",
                  font=("黑体", 25),
                  width=50,
                  height=2,
                  anchor="center")
    text1.place(x=70, y=40)
    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=480)

    button1_1 = Button(root,
                       text="Huffman",
                       font=("宋体", 25),
                       command=lambda: algorithm(1, root),
                       width=15,
                       height=2,
                       bg="#FFE4C4")
    button1_1.place(x=70, y=300)

    button1_2 = Button(root,
                       text="Zip",
                       font=("宋体", 25),
                       command=lambda: algorithm(2, root),
                       width=15,
                       height=2,
                       bg="#F4A460")
    button1_2.place(x=363, y=300)

    button1_3 = Button(root,
                       text="Lz4",
                       font=("宋体", 25),
                       command=lambda: algorithm(3, root),
                       width=15,
                       height=2,
                       bg="#CD5C5C")
    button1_3.place(x=656, y=300)

    button1_4 = Button(root,
                       text="Exit",
                       font=("宋体", 15),
                       command=lambda: sys.exit(),
                       width=5,
                       height=1,
                       bg="#E9967A")
    button1_4.place(x=860, y=600)

    root.mainloop()
示例#7
0
PROJECTING='projecting'
ROUND='round'
BEVEL='bevel'
MITER='miter'

# Arguments to xview/yview

MOVETO='moveto'
SCROLL='scroll'
UNITS='units'
PAGES='pages'

root = Tk() 
root.title("hello tkinter")
root.geometry("1000x700")
root.resizable(width=True, height=True)
root.tk.eval('package require Tix')

lable2 = Label(root, text="状态", bg="gray",bd=10, font=("Arial",12), width=8, height=3)
lable2.pack(anchor = NE)

lable3 = Label(root, text="正常", bg="gray",bd=10, font=("Arial",12), width=8, height=3)
lable3.pack(anchor = NE)


lable1 = Label(root, text="当前用户", bg="gray",bd=10, font=("Arial",12), width=8, height=3)
lable1.pack(anchor = NW)

button1 = Button(root, text="注销", activeforeground="black", bg="white",bd=5, font=("Arial",12), width=8, height=3)
button1.pack(anchor = NW)
示例#8
0
    pic_label.image = img

    string = str(file.get())

    # 预测的人
    predict = img2vector(string)
    # 加载模型
    LR = joblib.load('lr.model')
    predict_people = LR.predict(pca.transform(predict))

    string1 = str("编号:S%s 精确度:%f 召回率:%f" % (predict_people, accuray, recall))
    showinfo(title='图像分析', message=string1)


# 初始化Tk()
accuray, recall, pca = facefind()
root = Tk()  # root便是你布局的根节点了,以后的布局都在它之上
root.geometry('260x140')
root.title("人脸识别系统")  # 设置窗口标题
root.resizable(width=False, height=False)  # 设置窗口是否可变
root.tk.eval('package require Tix')  # 引入升级包,这样才能使用升级的组合控件
path = StringVar()  # 跟踪变量的值的变化

Button(root, text='选择图片', command=choosepic, width=1, height=1).grid(row=1, column=1, sticky=W + E + N + S, padx=40,
                                                                     pady=20)  # command指定其回调函数
file = Entry(root, state='readonly', text=path)
file.grid(row=0, column=1, sticky=W + E + S + N, padx=6, pady=20)  # 用作文本输入用

pic_label = Label(root, text='图片', padx=30, pady=10)
pic_label.grid(row=0, column=2, rowspan=4, sticky=W + E + N + S)
root.mainloop()
示例#9
0
文件: main.py 项目: FilipBudac/snake
    def end_game(self):
        self.delete(ALL)
        self.create_text(
            self.winfo_width() // 2,
            self.winfo_height() // 2,
            text=f"Score: {self.assets[AssetsEnum.BOARD.value].score}",
            fill="#fff",
            font=('Lucida Sans Unicode', 22))

    def snake_collision(self):
        x, y = self.assets[AssetsEnum.SNAKE.value].positions[0]
        for position in self.assets[AssetsEnum.SNAKE.value].positions[1:]:
            if position[0] == x and position[1] == y:
                self.end_game()


if __name__ == '__main__':
    snake = Snake()
    board = Board()
    food = Food()
    assets = [snake, food, board]

    root = Tk()
    root.title("Snake Game")
    root.resizable(False, False)

    SnakeGame(assets)

    root.mainloop()