예제 #1
0
    def __init__(self):
        self.root = Tk()
        ico = icopath() + 'glue.png'
        img = ImageTk.PhotoImage(Image.open(ico))
        self.root.tk.call('wm', 'iconphoto', self.root._w, img)
        self.root.title('flyPAD Glue')
        self.root.configure(bg='white')
        self.root.resizable(0, 0)
        self.nextbutton = -1

        style = ttk.Style()
        style.configure('.', font=('Helvetica', 12))

        self.lb = Listbox(self.root)
        lbxw = 5
        self.lb.grid(column=0, columnspan=lbxw, row=0)

        scrollbar = Scrollbar(self.root)
        scrollbar.grid(column=lbxw + 1, row=0, sticky=W + E + N + S)

        # attach listbox to scrollbar
        self.lb.config(width=40, yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.lb.yview)

        # add button
        add = self.add_button(self.root, "add.png", self.add)
        # remove button
        remove = self.add_button(self.root, "remove.png", self.remove)
        # glue button
        glue = self.add_button(self.root, "glue.png", self.glue)

        # canvas for data
        f = plt.Figure(figsize=(2, 0.5), dpi=100)
        self.ax = f.add_subplot(111)
        self.ax.axis('off')
        self.canvas = FigureCanvasTkAgg(f, master=self.root)
        self.canvas.draw()
        self.canvas.get_tk_widget().grid(row=2,
                                         column=0,
                                         columnspan=lbxw + 1,
                                         sticky=W + E + N + S)

        ### data structure
        self.data = {}
        self.buffer = []  # list of buffer times in secs
    def __init__(self):
        self.root = Tk()
        ico = icopath() + 'glue.png'
        img = ImageTk.PhotoImage(Image.open(ico))
        self.root.tk.call('wm', 'iconphoto', self.root._w, img)
        self.root.title('flyPAD Conditioner')
        self.root.configure(bg='white')
        self.root.resizable(0, 0)
        self.nextbutton = -1

        style = ttk.Style()
        style.configure('.', font=('Helvetica', 12))

        topframe = Frame(self.root)
        topframe.pack()
        self.lb = Listbox(topframe)
        lbxw = 5
        self.lb.pack(side=LEFT)

        scrollbar = Scrollbar(topframe)
        scrollbar.pack(side=LEFT)

        # attach listbox to scrollbar
        self.lb.config(width=50, yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.lb.yview)

        bottomframe = Frame(self.root)
        bottomframe.pack(side=BOTTOM)
        # add button
        add = self.add_button(bottomframe, "add.png", self.add)
        # remove button
        remove = self.add_button(bottomframe, "remove.png", self.remove)
        # glue button
        glue = self.add_button(bottomframe, "edit.png", self.edit)

        ### data structure
        self.data = {}
        self.buffer = []  # list of buffer times in secs
예제 #3
0
 def add_image(self, _name):
     image = Image.open(icopath() + _name)
     image = image.resize(
         (36, 36), Image.ANTIALIAS)  #The (250, 250) is (height, width)
     return ImageTk.PhotoImage(image)