-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui_text.py
More file actions
66 lines (55 loc) · 1.53 KB
/
Copy pathgui_text.py
File metadata and controls
66 lines (55 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from Tkinter import *
import tkFileDialog as browse
import os
from PIL import Image
import ImageTk
import tkMessageBox as popup
from ascii_text import *
class App:
def __init__(self,root):
frame = Frame(root)
frame.pack()
self.b1=Button(frame,text="Convert",fg='red',command=self.hey)
self.b1.pack(side=RIGHT)
self.b2=Button(frame,text="Load File",fg='black',command=self.browse_it)
self.b2.pack(side=LEFT)
self.frame2=Frame(frame)
self.frame2.pack()
self.Artwork=None
self.p=""
self.n=""
def hey(self):
if self.p!="" or self.n!="":
generate(self.p,self.n)
else:
popup.showerror("Error!!","First load a file please...")
def browse_it(self):
try:
self.Artwork.destroy()
except Exception:
pass
f=browse.askopenfilename()
t=f.split("/")
path=""
for i in range(0,len(t)-1):
path+=t[i]
path+="\\"
fn=t[-1]
self.p=path
self.n=fn
im1=Image.open(f)
im2=im1.copy()
im2.thumbnail((128,128),Image.ANTIALIAS)
im3=ImageTk.PhotoImage(im2)
self.Artwork=Label(root,image=im3)
self.Artwork.im3=im3
self.Artwork.pack(side=BOTTOM)
def main():
global root
root = Tk()
root.resizable(width=FALSE,height=FALSE)
root.geometry("400x400")
app=App(root)
root.mainloop()
if __name__=='__main__':
main()