Category : tkinter-canvas

So far I have this, which works fine: def OnHover(event): canvas.itemconfig(c1, outline="#3385ff", width = hw) def UnHover(event): canvas.itemconfig(c1, outline="") canvas.tag_bind(shape, ‘<Enter>’, OnHover) canvas.tag_bind(shape, ‘<Leave>’, UnHover) I’m wondering if it is possible to use a small amount of code to give multiple shapes this effect. I currently have this, which is considerably messy and could be ..

Read more

I’m trying to generate an arbitrary number of rows, where each row contains a label in the left side and a scrolled canvas on the right. My code is as follows: import tkinter as tk class App(tk.Frame): def __init__(self, root): super(App, self).__init__(root) self.root = root # CREATE OUTER FRAMES # self.main_frame = MainFrame(root) self.main_frame.pack(padx=0, pady=0) ..

Read more

def doAnchoreGraph(image): info = infoAnchoreLog(image) window = Toplevel() window.geometry("1200×1200") data = {‘CVE’: [‘CRITICAL’,’HIGH’,’MEDIUM’,’LOW’], ‘Frequency’: [info[1],info[2],info[3],info[4]] } df = DataFrame(data,columns=[‘CVE’,’Frequency’]) figure = plt.Figure(figsize=(10,8), dpi=200) ax = figure.add_subplot(111) bar = FigureCanvasTkAgg(figure, window) bar.get_tk_widget().pack(side=tk.LEFT, fill=tk.BOTH) df = df[[‘CVE’,’Frequency’]].groupby(‘CVE’).sum() df.plot(kind=’bar’, legend=True, ax=ax) ax.set_title(‘CVE Vs. Frequency’) figure.show() filename = "anchorescan-" + image + ".png" plt.savefig(filename) When I open the file, ..

Read more