Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 38 additions & 24 deletions tkinter-skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'''
TO DO LIST

- Add functionality that allows emails to be moved
- Fix Pathing Error in Windows
- Use threading instead of sigalarm since it doesnt work reliable
- Debug functionalities on Windows machines, such as key binds, etc
Expand All @@ -19,7 +20,7 @@

IDEAS FOR FUTURE

- Add functionality that allows emails to be moved

- Fix Anti-scrape policy
- idea 1: create a separate bot that identifies whether an article is
- idea 2: rotate IP addresses, delay scrape time
Expand Down Expand Up @@ -513,19 +514,25 @@ def embedChart(self, master, fig=None, side=tk.TOP, legends=None, title=None):
def onselect(self, event):
w = event.widget


# for when the logs listbox is selected
if w == self.logs_lbox:
index = int(w.curselection()[0])
value = w.get(index)
self.current_log = 'logs/' + value
self.df = pd.read_csv(self.current_log)
try:
index = int(w.curselection()[0])
value = w.get(index)
self.current_log = 'logs/' + value
self.df = pd.read_csv(self.current_log)

# refreshes the top info screen
self.refreshFrame(self.rightmainframe)
self.refreshFrame(self.leftmainframe)
# refreshes the top info screen
self.refreshFrame(self.rightmainframe)
self.refreshFrame(self.leftmainframe)

# builds table
self.buildBottomTable()

# builds table
self.buildBottomTable()
# this sometimes happens when the user clicks somewhere random
except IndexError:
pass

# for when the bottom table is selected
elif w == self.tree:
Expand Down Expand Up @@ -930,34 +937,41 @@ def __init__(self, parent, title='Title'):

self.folder = tk.StringVar(value='Priority Mail')
self.cap_at = tk.IntVar(value=0)

self.waitTime = tk.StringVar(value='Approx. Wait Time: 0 mins') # approx wait time
self.cap_at.set(0)

simpledialog.Dialog.__init__(self, parent, title)



def body(self, master):

# initializes the approx. wait time string
waitTime = tk.StringVar(value='Approx. Wait Time: 0 mins') # approx wait time

# used to update the stringVar waittime
def callback(*args):
try:
t = self.cap_at.get()
waitTime.set('Approx. Wait Time: {:.0f} mins'.format(np.ceil(t / 8))) # approx wait time

# this is a bug with tkinter, so i'm going to catch this exception
except tk.TclError:
pass

# sets up the body of the dialogbox
folders = ('Priority Mail', 'INBOX')
tk.Label(master, text='Choose a Folder:').grid(row=0, column=0)
menu = tk.OptionMenu(master, self.folder, *folders)
menu.config(width=10)
menu.grid(row=0, column=1)

tk.Label(master, text='Classify How Many Emails:').grid(row=1, column=0)
tk.Entry(master, textvariable=self.cap_at).grid(row=1, column=1)

# self.pb = ttk.Progressbar(master, orient='horizontal', mode='determinate')
# self.pb.grid(row=2, column=0, columnspan=3)
# tk.Label(master, text='Create Logs (Highly Recommended)').grid(row=2, column=0)
# checkbutton = tk.Checkbutton(master, text='Create Logs (Highly Recommended)',
# variable=self.checked)
# checkbutton.grid(row=2, column=1)

self.msgLabel = tk.Label(master, textvariable=self.waitTime)
self.msgLabel.grid(row=2, column=0, columnspan=5)
# self.msgLabel.grid_forget() # hides the label for now
msgLabel = tk.Label(master, textvariable=waitTime)
msgLabel.grid(row=2, column=0, columnspan=5)

self.msgLabel.config(text='Approx. Wait Time: {} mins'.format(np.ceil(self.cap_at.get() / 10)))
# updates the wait time accordingly
self.cap_at.trace_add('write', callback)

def validate(self):
# if self.checked.get() > 0:
Expand Down