Hey,
I need help with a python Tkinter code piece. Basically, the program isn't quitting. It works fine, encryption and all are happening, but the QUIT button doesn't work, and new windows keep opening up. Can someone help?
When the user clicks either "encrypt" or "decrypt", the program should go back to the first window that comes up (delete the second window or something?!) and when the user clicks "quit", the program should end.
The various imports in the starting are my own .py files (compiled).
I'm just using 4 of them yet.. want them to work before I integrate all 8.
HELP!!!:huh::huh::huh:
I need help with a python Tkinter code piece. Basically, the program isn't quitting. It works fine, encryption and all are happening, but the QUIT button doesn't work, and new windows keep opening up. Can someone help?
When the user clicks either "encrypt" or "decrypt", the program should go back to the first window that comes up (delete the second window or something?!) and when the user clicks "quit", the program should end.
The various imports in the starting are my own .py files (compiled).
I'm just using 4 of them yet.. want them to work before I integrate all 8.
HELP!!!:huh::huh::huh:
Code:
import my_encryptor
import my_decryptor
import lzw_encryptor
import lzw_decryptor
import vig_encryptor
import vig_decryptor
import rsa_encryptor
from Tkinter import *
class sel1:
def __init__(self,parent):
frame = Frame(parent)
frame.pack()
self.Cust1 = Button(frame,text="Custom Algorithm 1",command=self.selcust1)
self.Cust2 = Button(frame,text="Vigenere Cypher",command=self.selvig)
self.Cust1.pack(side=TOP)
self.Cust2.pack()
self.but = Button(frame,text="Quit",fg="red",command=frame.quit)
self.but.pack(side=BOTTOM)
def selcust1(self):
self.new = Toplevel()
frame2=Frame(self.new)
frame2.pack()
self.enc = Button(frame2,text="Encrypt",command=self.selcust1enc)
self.dec = Button(frame2,text="Decrypt",command=self.selcust1dec)
self.enc.pack(side=LEFT)
self.dec.pack(side=RIGHT)
def selvig(self):
self.new = Toplevel()
frame2=Frame(self.new)
frame2.pack()
self.enc = Button(frame2,text="Encrypt",command=self.selvigenc)
self.dec = Button(frame2,text="Decrypt",command=self.selvigdec)
self.enc.pack(side=LEFT)
self.dec.pack(side=RIGHT)
def selcust1enc(self):
self.new.quit()
my_encryptor.my_encryptor("abc.txt","a.txt")
def selcust1dec(self):
self.new.quit()
my_decryptor.my_decryptor("a.txt","b.txt")
root = Tk()
prog = sel1(root)
root.mainloop()