def askopenfilename(self):
filename= tkFileDialog.askopenfilename(initialdir='C:/..',title='Select File' , filetypes=[('Bitmap Images', '*.bmp'),('Png Images', '*.png'),('Gif Images', '*.gif'),("Jpeg","*.jpg"),("All files", "*")])
self.entryVariable.set(filename)
if filename == None:
return open(filename,'rb')
self.entry.update(filename)
self.image = Image.open(filename)
self.img = ImageTk.PhotoImage(self.image)
self.canvas.config(width=400, height=300)
self.lab.img = self.img
self.lab.pack()
self.canvas.create_image(1,1, anchor=NW, image=self.img)
self.scrollbar_vert = Scrollbar(self.canvas)
self.scrollbar_vert.pack(side=RIGHT, fill=Y)
self.scrollbar_hor = Scrollbar(self.canvas)
self.scrollbar_hor.config(orient=HORIZONTAL)
self.scrollbar_hor.pack(side=BOTTOM, fill=X)
self.canvas.config(yscrollcommand=self.scrollbar_vert.set)
self.canvas.config(xscrollcommand=self.scrollbar_hor.set)
self.canvas.config(scrollregion=self.canvas.bbox(ALL))
self.scrollbar_vert.config(command=self.canvas.yview)
self.scrollbar_hor.config(command=self.canvas.xview)
def encode_files(self):
image = self.lab.img
data_in = self.data_entry
data = data_in.read()
encoded = LSB.encode(image, data)
image.save('C:\\Python27\\self.image_new.png')
self.canvas.config(xscrollcommand=self.scrollbar_hor.set)
self.canvas.config(scrollregion=self.canvas.bbox(ALL))
self.scrollbar_vert.config(command=self.canvas.yview)
self.scrollbar_hor.config(command=self.canvas.xview)
def encode_files(self):
image = self.lab.img
data_in = self.data_entry
data = data_in.read()
encoded = LSB.encode(image, data)
image.save('C:\\Python27\\self.image_new.png')
La 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.