每天读取文件,改文件地址真的好烦,突发奇想做一款能换斜杠的小程序,虽然很简陋但勉强能用,需要的自取。
百度网盘
链接:https://pan.baidu.com/s/1vc3g3ArHATDpbEFQV8g8ew?pwd=0000
提取码:0000
from tkinter import *
root=Tk()
root.title('地址转换器')
root.iconbitmap('C:/Users/YANGNAN/Desktop/1/狗子.ico')
root.resizable(False,False)
# root['background']='#b3d9ff'
frame=Frame(root)
v1=StringVar()
v2=StringVar()
l1=Label(root,text='本软件用于路径地址转换').grid(row=0,column=1)
l2=Label(root,text='请输入路径地址:').grid(row=1,column=0,sticky=W)
l3=Label(root,text='转换后的路径地址:').grid(row=2,column=0,sticky=W)
e1=Entry(root,textvariable=v1,validate='key')
e2=Entry(root,textvariable=v2,state='readonly')
e1.grid(row=1,column=2,sticky=E)
e2.grid(row=2,column=2,sticky=E)
# image=Image
# Photo=PhotoImage(file='C:/Users/YANGNAN/OneDrive/桌面/python进阶/080911060311_0狗子.ico')
width =400
height = 150
screenwidth = root.winfo_screenwidth()
screenheight = root.winfo_screenheight()
size_geo = '%dx%d+%d+%d' % (width, height, (screenwidth-width)/2, (screenheight-height)/2)
root.geometry(size_geo)
def transform():
ls=v1.get()
lt=ls.replace('\\','/')
v2.set(str(lt))
Button(root,text='转换',width=10,command=transform,padx=10,pady=5).grid(row=3,column=0)
Button(root,text='退出',width=10,command=root.quit,padx=10,pady=5).grid(row=3,column=2)
mainloop()