class Main(tk.Tk):
    def __init__(self):
        tk.Tk.__init__(self)
        self.filename = None
        self.origin_image = None
        self.processed_image = None
        
        self.title("Segmentation and Edge Detection")

        self.toolbar = ToolBar(master=self)
        separator = ttk.Separator(master=self)
        self.image_viewer = Viewer(master=self)

        self.toolbar.pack(pady=10)
        separator.pack(fill=tk.X, padx=20, pady=5)
        self.image_viewer.pack(fill=tk.BOTH, padx=20, pady=10, expand=1)
예제 #2
0
파일: gui.py 프로젝트: tuncaemre/SpecDAL
class SpecdalGui(tk.Tk):
    """GUI entry point for Specdal"""
    def __init__(self, collections=None):
        tk.Tk.__init__(self)

        # create menubar
        self.config(menu=Menubar(self))

        # create list
        self.collectionList = CollectionList(self, collections)
        self.collectionList.pack(side=tk.LEFT, fill=tk.Y)

        # create viewer
        self.viewer = Viewer(self,
                             self.collectionList.currentCollection,
                             with_toolbar=False)
        self.viewer.pack(side=tk.LEFT, fill=tk.BOTH)

    def read_dir(self):
        directory = filedialog.askdirectory()
        if not directory:
            return
        self.collectionList.add_collection(
            Collection(name="collection" +
                       str(self.collectionList.listbox.size()),
                       directory=directory))

    def group_by(self, collection=None):
        separator = tksd.askstring("separator",
                                   "Enter separator pattern",
                                   initialvalue="_")
        if separator is None:
            return
        indices = tksd.askstring("indices",
                                 "Enter indices to group by (comma separated)",
                                 initialvalue="0")
        if indices is None:
            return
        indices = list(map(int, indices.replace(" ", "").split(",")))
        if collection is None:
            collection = self.collectionList.currentCollection
        groups = collection.groupby(separator=separator,
                                    indices=indices,
                                    filler=None)
        for gname, gcoll in groups.items():
            gcoll.name = collection.name + " (" + gcoll.name + ")"
            self.collectionList.add_collection(gcoll)
예제 #3
0
class Main(tk.Tk):
    def __init__(self):
        tk.Tk.__init__(self)

        self.filename = None
        self.origin_image = None
        self.processed_image = None
        self.filter_frame = None
        self.adjust_frame = None
        self.is_image_select = False
        self.is_draw_state = False
        self.is_crop_state = False
        self.x1 = 1
        self.y1 = 1

        self.title("Image Editor")

        self.toolbar = ToolBar(master=self)
        separator1 = ttk.Separator(master=self, orient=tk.HORIZONTAL)
        self.image_viewer = Viewer(master=self)

        self.toolbar.pack(pady=10)
        separator1.pack(fill=tk.X, padx=20, pady=5)
        self.image_viewer.pack(fill=tk.BOTH, padx=20, pady=10, expand=1)