|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
from tkinter import *
from time import *
import tkinter.filedialog
import io
import cv2
from PIL import Image, ImageTk
import numpy as np
import tensorflow as tf
import tkinter.messagebox
a = [""]
root = Tk() #创建主窗体
w_box = 700
h_box = 500
root.title('Tensorflow实现手写数字识别
这个是背景图
')
# 获取此电脑的横向分辨率
sw = root.winfo_screenwidth()
# 获取此电脑的纵向分辨率
sh = root.winfo_screenheight()
w1 = (sw - 700) / 2
w2 = (sh - 500) /2
# 使GUI界面居中
root.geometry('700x500+%d+%d'%(w1,w2))
image_file = Image.open('4.jpg')
photo = ImageTk.PhotoImage(image_file)
fwagui=tkinter.Frame(root,padx=10,pady=10).grid(row=0,column=0)
tkinter.Label(fwagui,image=photo).grid(row=0,column=0,rowspan=3,columnspan=3)
Button(root, text='退出', width=10,background="#8C8476", command=root.quit) \
.grid(row=15, column=0, sticky=W, padx=10, pady=15,ipadx=10,ipady=2)
mainloop()
from tkinter import *
from time import *
import tkinter.filedialog
import io
import cv2
from PIL import Image, ImageTk
import numpy as np
#import tensorflow as tf
import tkinter.messagebox
a = [""]
root = Tk() #创建主窗体
w_box = 700
h_box = 500
root.title('Tensorflow实现手写数字识别')
# 获取此电脑的横向分辨率
sw = root.winfo_screenwidth()
# 获取此电脑的纵向分辨率
sh = root.winfo_screenheight()
w1 = (sw - 700) / 2
w2 = (sh - 500) /2
# 使GUI界面居中
root.geometry('700x500+%d+%d'%(w1,w2))
image_file = Image.open('4.jpg')
photo = ImageTk.PhotoImage(image_file)
fwagui=tkinter.Frame(root,padx=10,pady=10).grid(row=0,column=0)
# ---------------------------
canvas = tkinter.Canvas(fwagui)
canvas.create_image((350,250), anchor=CENTER, image=photo)
canvas.grid(row=0,column=0,rowspan=3,columnspan=3,ipadx=700,ipady=500)
# ---------------------------
Button(canvas, text='退出', width=10,background="#8C8476", command=root.quit) \
.grid(row=15, column=0, sticky=W, padx=10, pady=15,ipadx=10,ipady=2)
mainloop()
|
|