コード例 #1
0
ファイル: simple_window.py プロジェクト: hopsmdev/playground
def add_combobox(window, width=10, column=0, row=0, values=None):
    text = tk.StringVar()
    text_chosen = ttk.Combobox(
        window, width=width, textvariable=text, state='readonly')
    text_chosen.grid(column=column, row=row)
    text_chosen['values'] = values
    return text_chosen
コード例 #2
0
    def erstelleEingabeFenster(self):
        # Label für Schwierigkeitsgrad
        self.label1 = tk.Label(self, text="Schwierigkeitsgrad auswählen:")
        self.label1.pack(side=tk.TOP)

        # Eine Combobox mit den Schwierigkeitsgraden wird erstellt
        self.schwierigkeitsgrade = {'Leicht': 1, 'Mittel': 2, 'Schwer': 3}
        self.auswahl_liste_schwierigkeitsgrad = ttk.Combobox(
            self,
            values=list(self.schwierigkeitsgrade.keys()),
            state='readonly')
        self.auswahl_liste_schwierigkeitsgrad.pack(side=tk.TOP)

        # Label für die Größe des Spielfelds
        self.label2 = tk.Label(self, text="Größe des Spielfelds auswählen:")
        self.label2.pack(side=tk.TOP)

        # Eine Combobox mit den Größen des Spielfelds
        self.größen_spielfeld = {'10 x 10': 10, '12 x 12': 12, '14 x 14': 14}
        self.auswahl_liste_größe_spielfeld = ttk.Combobox(
            self, values=list(self.größen_spielfeld.keys()), state='readonly')
        self.auswahl_liste_größe_spielfeld.pack(side=tk.TOP)

        # blauer Button für die Anzeige der Lösung
        self.button_lösung = tk.Button(
            self,
            width=10,
            height=3,
            text='Lösung anzeigen\n+ Roboter automatisch bewegen lassen',
            command=self.zeigeLösung)

        self.button_lösung['bg'] = '#52CDFB'
        self.button_lösung.pack(side=tk.BOTTOM, fill=tk.BOTH)

        # gelber Start-Button
        self.button_start = tk.Button(self,
                                      width=10,
                                      height=3,
                                      text="Erzeuge Spielumgebung",
                                      command=self.starte)

        self.button_start['bg'] = 'yellow'
        self.button_start.pack(side=tk.BOTTOM, fill=tk.BOTH)
コード例 #3
0
    def SetUp(self):
        self.TimeSeriesList = utils.sort_series(
            list(self.Model.EquationSolver.TimeSeries.keys()))
        self.SeriesBoxValue = StringVar()
        content = ttk.Frame(self)
        frame = ttk.Frame(content, borderwidth=5, relief='sunken')
        self.BoxWidget = ttk.Combobox(content,
                                      textvariable=self.SeriesBoxValue)
        self.BoxWidget.state([
            'readonly',
        ])
        self.BoxWidget['values'] = self.TimeSeriesList
        # self.SeriesBoxValue.trace('w', self.ComboChange())
        self.BoxWidget.bind('<<ComboboxSelected>>', self.ComboChange)
        self.BoxWidget.current(0)
        button = tk.Button(content, text='Next', command=self.OnButtonClick)
        button2 = tk.Button(content, text='Quit', command=self.quit)

        self.Equation = tk.Entry(content,
                                 state=['readonly'],
                                 textvariable=self.EquationString)
        self.EntryDescription = tk.Entry(content,
                                         state=[
                                             'readonly',
                                         ],
                                         textvariable=self.DescriptionString)
        self.CanvasFigure = matplotlib.pyplot.figure(1)
        Fig = matplotlib.figure.Figure(figsize=(7.5, 5), dpi=90)
        subplot = Fig.add_subplot(111)
        x = []
        y = []
        self.Line, = subplot.plot(x, y, 'bo-')
        self.Canvas = FigureCanvasTkAgg(Fig, master=content)
        self.OnButtonClick()
        content.grid(column=0, row=0)
        frame.grid(column=0, row=0, columnspan=7, rowspan=3)
        self.BoxWidget.grid(row=0, column=0, columnspan=2)
        button.grid(column=5, row=0)
        button2.grid(column=6, row=0)
        self.EntryDescription.grid(row=0,
                                   column=2,
                                   columnspan=3,
                                   sticky=['w', 'e'])
        self.Equation.grid(row=1, column=0, columnspan=7, sticky=['w', 'e'])
        self.Canvas.get_tk_widget().grid(column=0,
                                         row=2,
                                         columnspan=7,
                                         sticky=['n', 's', 'e', 'w'])
        content.columnconfigure(2, weight=1)
        content.columnconfigure(3, weight=1)
        content.columnconfigure(4, weight=1)
        content.rowconfigure(2, weight=1)
        self.Canvas.show()
        self.resizable(width=True, height=True)
        self.update()
コード例 #4
0
   def _create_demo_panel(self): 
       demoPanel = Frame(self) 
       demoPanel.pack(side=TOP, fill=BOTH, expand=Y) 
             
       # create comboboxes 
       cbp1 = ttk.Labelframe(demoPanel, text='Fully Editable') 
       cb1 = ttk.Combobox(cbp1) 
       cb1.bind('<Return>', self._update_values) 
       cb1.pack(pady=5, padx=10) 
 
       cbp2 = ttk.Labelframe(demoPanel, text='Disabled') 
       ttk.Combobox(cbp2, state='disabled').pack(pady=5, padx=10) 
         
       cities = ('Toronto', 'Ottawa', 'Montreal', 'Vancouver', 'St. John') 
       cbp3 = ttk.Labelframe(demoPanel, text='Pre-defined List') 
       cb3 = ttk.Combobox(cbp3, values=cities, state='readonly') 
       cb3.current(1)  # set selection 
       cb3.pack(pady=5, padx=10) 
 
       # position and display 
       cbp1.pack(in_=demoPanel, side=TOP, pady=5, padx=10) 
       cbp2.pack(in_=demoPanel, side=TOP, pady=5, padx=10) 
       cbp3.pack(in_=demoPanel, side=TOP, pady=5, padx=10) 
コード例 #5
0
    def __build(self):

        self.master.title("Issue To-do")
        self.master.minsize(500, 400)

        self.pack(fill=BOTH, expand=True)

        self.__toolbar = Frame(self, bd=1, relief='groove')
        self.__toolbar.columnconfigure(2, weight=1)

        self.__issues = Listbox(self)

        # config toolbar
        self.__add = Button(self.__toolbar,
                            text="Add",
                            command=self.__add_issue,
                            state="disabled")
        self.__add.grid(column=0, row=0)

        self.__del = Button(self.__toolbar,
                            text="Delete",
                            command=self.__del_issue,
                            state="disabled")
        self.__del.grid(column=1, row=0)

        self.__selected_ns = StringVar()
        self.__spaces = ttk.Combobox(self.__toolbar,
                                     textvariable=self.__selected_ns,
                                     state="readonly")
        self.__spaces.grid(column=2, row=0, sticky=(N, E, S, W))

        self.__spaces.bind('<<ComboboxSelected>>', self.__onselect)

        self.__add_ns = Button(self.__toolbar,
                               text="Add Namespace",
                               command=self.__add_ns)
        self.__add_ns.grid(column=3, row=0)

        self.__toolbar.pack(side=TOP, expand=0, fill=BOTH)
        self.__issues.pack(expand=1, fill=BOTH)

        self.__issues.bind('<Double-1>', self.__issue_dbl_click)
コード例 #6
0
 def create_widgets_load(self):
     self.load_label = Label(
         self.load_frame,
         text="Seleccione una pieza o crea una nueva:",
         font=("Arial Bold", 12),
         justify=LEFT,
         fg=self.colors.label,
         bg=self.colors.background)  #RIGHT #CENTER #LEFT
     self.load_label.pack(fill=X)
     self.combo = ttk.Combobox(self.load_frame, state="readonly")
     #self.combo = ttk.Combobox(self.load_frame)
     self.combo.pack(fill=X)
     self.combo["values"] = ["Python", "C", "C++", "Java"]
     self.combo_label = tk.Label(self.load_frame,
                                 text="averdonde",
                                 font=('Arial', 11),
                                 justify=LEFT,
                                 fg=self.colors.label,
                                 bg=self.colors.background)
     self.combo_label.pack(fill=X)
     self.combo.current(0)
     """
コード例 #7
0
def run_gui():
    # Create app
    root = tk.Tk()
    
    # App parameters
    root.title('HAZUS - TwoPAGER File Utility')
    root.geometry('520x250')
    root.configure(background='#282a36')
                   
    # App functions
    def get_scenarios():
        comp_name = os.environ['COMPUTERNAME']
        c = py.connect('Driver=ODBC Driver 11 for SQL Server;SERVER=' +
            comp_name + '\HAZUSPLUSSRVR; UID=SA;PWD=Gohazusplus_02')
        cursor = c.cursor()
        cursor.execute('SELECT * FROM sys.databases')
        exclusion_rows = ['master', 'tempdb', 'model', 'msdb', 'syHazus', 'CDMS', 'flTmpDB']
        scenarios = []
        for row in cursor:
            if row[0] not in exclusion_rows:
                scenarios.append(row[0])
        return scenarios

    def browsefunc():
        root.directory = filedialog.askdirectory()
        pathlabel_outputDir.config(text=root.directory)

    def on_field_change(index, value, op):
        try:
            input_scenarioName = dropdownMenu.get()
            check = input_scenarioName in root.directory
            if not check:
                pathlabel_outputDir.config(text='Output directory: ' + root.directory + '/' + input_scenarioName)           
        except:
            pass
    
    def run():
        # input_scenarioName = text_name.get("1.0",'end-1c').strip()
        input_scenarioName = dropdownMenu.get()
        try:
            two_pager(input_scenarioName, root.directory, False)
            tk.messagebox.showinfo("HAZUS Message Bot", "Success! Output files can be found at: " + str(root.directory) + "/" + input_scenarioName)
        except:
            tk.messagebox.showerror("HAZUS Message Bot", "Unable to process. Please check your inputs and try again.")
            
    def setup(scenario_name, folder_path):
        #Make a folder in folder_path for scenario_name
        if not os.path.exists(folder_path + '\\' + scenario_name):
            os.makedirs(folder_path + '\\' + scenario_name)
        #Connect to Hazus SQL Server database where scenario results are stored
        comp_name = os.environ['COMPUTERNAME']
        cnxn = py.connect('Driver=ODBC Driver 11 for SQL Server;SERVER=' + comp_name + '\HAZUSPLUSSRVR;DATABASE=' + scenario_name + ';UID=hazuspuser;PWD=Gohazusplus_02')
        return comp_name, cnxn
    
    def results(hazus_results_df):
            #Join and group Hazus result dataframes into final TwoPAGER dataframes
            tract_results = hazus_results_df['county_fips'].join([hazus_results_df['econ_loss'], hazus_results_df['demographics'], hazus_results_df['impact'],
                            hazus_results_df['injury'], hazus_results_df['building_damage']])
            county_results = tract_results.groupby('CountyFips').sum()
            return tract_results, county_results
        
    def to_ftp(folder_path, scenario_name):
        #Upload TwoPAGER text files and shapefile to FEMA FTP site
        load_files = ['building_damage_occup.csv', 'building_damage_bldg_type.csv', 'tract_results.csv',
                        'county_results.csv', 'tract_results.dbf', 'tract_results.shp']
        credentials = {'host': 'data.femadata.com', 'username': '******', 'password': '******',
                        'dir': '/FIMA/NHRAP/Earthquake/TwoPAGER'}
        transport = paramiko.Transport(credentials['host'], 22)
        transport.connect(username=credentials['username'], password=credentials['password'])
        sftp = paramiko.SFTPClient.from_transport(transport)
        sftp.chdir(credentials['dir'])
        dirs = sftp.listdir()
        if str(scenario_name) not in dirs:
            sftp.mkdir(scenario_name)
            sftp.chmod((credentials['dir'] + '/' + scenario_name), mode=777)
        for i in load_files:
            local_path = folder_path + '\\' + scenario_name + '\\' + i
            remote_path = './' + scenario_name + '//' + i
            sftp.put(local_path, remote_path)
            sftp.chmod(remote_path, mode=777)
        sftp.close()
        return credentials
    
    def to_shp(folder_path, scenario_name, hazus_results_df, tract_results):
            # spatial_df = hazus_results_df['tract_spatial'].drop(['Tract'], axis=1).reset_index()
        df = tract_results.join(hazus_results_df['tract_spatial'])
        df['Coordinates'] = df['Shape'].apply(wkt.loads)
        gdf = gpd.GeoDataFrame(df, geometry='Coordinates')
        crs={'proj':'longlat', 'ellps':'WGS84', 'datum':'WGS84','no_defs':True}
        gdf.crs = crs
        gdf.to_file(folder_path + '/' + scenario_name + '/' + 'tract_results.shp', driver='ESRI Shapefile')
            #Create shapefile of TwoPAGER tract table
            # schema = {
            #     'geometry': 'Polygon',
            #     'properties': {'Tract': 'str',
            #                     'CountyFips': 'int',
            #                     'EconLoss': 'float',
            #                     'Population': 'int',
            #                     'Households': 'int',
            #                     'DebrisW': 'float',
            #                     'DebrisS': 'float',
            #                     'DisplHouse': 'float',
            #                     'Shelter': 'float',
            #                     'NonFatal5p': 'float',
            #                     'NoDamage': 'float',
            #                     'GreenTag': 'float',
            #                     'YellowTag': 'float',
            #                     'RedTag': 'float'},
            #                     }
            # with fiona.open(path=folder_path + '\\' + scenario_name + '\\tract_results.shp', mode='w', driver='ESRI Shapefile', schema=schema, crs={'proj':'longlat', 'ellps':'WGS84', 'datum':'WGS84', 'no_defs':True}) as c:
            #     for index, row in hazus_results_df['tract_spatial'].iterrows():
            #         for i in row:
            #             tract = shapely.wkt.loads(i)
            #             c.write({'geometry': mapping(tract),
            #                     'properties': {'Tract': index,
            #                                     'CountyFips': str(np.int64(tract_results.loc[str(index), 'CountyFips'])),
            #                                     'EconLoss': str(np.float64(tract_results.loc[str(index), 'EconLoss'])),
            #                                     'Population': str(np.int64(tract_results.loc[str(index), 'Population'])),
            #                                     'Households': str(np.int64(tract_results.loc[str(index), 'Households'])),
            #                                     'DebrisW': str(np.float64(tract_results.loc[str(index), 'DebrisW'])),
            #                                     'DebrisS': str(np.float64(tract_results.loc[str(index), 'DebrisS'])),
            #                                     'DisplHouse': str(np.float64(tract_results.loc[str(index), 'DisplHouse'])),
            #                                     'Shelter': str(np.float64(tract_results.loc[str(index), 'Shelter'])),
            #                                     'NonFatal5p': str(np.float64(tract_results.loc[str(index), 'NonFatal5p'])),
            #                                     'NoDamage': str(np.float64(tract_results.loc[str(index), 'NoDamage'])),
            #                                     'GreenTag': str(np.float64(tract_results.loc[str(index), 'GreenTag'])),
            #                                     'YellowTag': str(np.float64(tract_results.loc[str(index), 'YellowTag'])),
            #                                     'RedTag': str(np.float64(tract_results.loc[str(index), 'RedTag']))}
            #                                     })
            # c.close()
    
    #Roll up subfunctions into one overall function
    def two_pager(scenario_name, folder_path, ftp=False):
        comp_name, cnxn = setup(scenario_name, folder_path)
        hazus_results_df = read_sql(comp_name, cnxn, scenario_name)
        tract_results, county_results = results(hazus_results_df)
        to_csv(hazus_results_df, tract_results, county_results, folder_path, scenario_name)
        to_shp(folder_path, scenario_name, hazus_results_df, tract_results)
        if ftp == True:
            credentials = to_ftp(folder_path, scenario_name)
            print('Hazus earthquake results available for download at: https://' + credentials['host'] + credentials['dir'] + '/' + scenario_name)
        print('Hazus earthquake results available locally at: ' + folder_path + '\\' + scenario_name)
    
    # App body
    # Scenario name
    label_scenarioName = tk.Label(root, text='Input: HAZUS scenario name.', font='Helvetica 10 bold', bg='#282a36', fg='#f8f8f2')
    label_scenarioName.grid(row=3, column=0, padx=20, pady=(20, 10), sticky=W)
    
    label_name = tk.Label(root, text='Name: ', font='Helvetica 8 bold', bg='#282a36', fg='#f8f8f2')
    label_name.grid(row=4, column=0, sticky=W, pady=(0, 5), padx=24)
    v = StringVar()
    v.trace('w', on_field_change)
    dropdownMenu = ttk.Combobox(root, textvar=v, values=get_scenarios(), width=35)
    dropdownMenu.grid(row = 4, column =0, padx=(195, 0), pady=(0,5), sticky='W')
    # text_name = tk.Text(root, height=1, width=35, relief=FLAT)
    # text_name.grid(row=4, column=0, pady=(0, 5), sticky=W, padx=120)
    # text_name.insert(END, '')
    
    # Out DAT file name
    label_outputDir = tk.Label(root, text='Output: Select a directory for the output files.', font='Helvetica 10 bold', bg='#282a36', fg='#f8f8f2')
    label_outputDir.grid(row=10, column=0, padx=20, pady=20, sticky=W)
    
    browsebutton_dat = tk.Button(root, text="Browse", command=browsefunc, relief=FLAT, bg='#44475a', fg='#f8f8f2', cursor="hand2", font='Helvetica 8 bold')
    browsebutton_dat.grid(row=10, column=0, padx=(375, 0), sticky=W)
    
    pathlabel_outputDir = tk.Label(root, bg='#282a36', fg='#f8f8f2', font='Helvetica 8')
    pathlabel_outputDir.grid(row=11, column=0, pady=(0, 20), padx=40, sticky=W)
    
    button_run = tk.Button(root, text='Run', width=20, command=run, relief=FLAT, bg='#6272a4', fg='#f8f8f2', cursor="hand2", font='Helvetica 8 bold')
    button_run.grid(row=12, column=0, pady=(0, 20), padx=180)
    
    # Run app
    root.mainloop()
コード例 #8
0
ファイル: dubbing.py プロジェクト: gravity-addiction/sdobox
    def __init__(self, parent, title=None, video=''):
        Tk.Frame.__init__(self, parent)

        self.compDataset = []
        self.compComboOptions = ["Select Competition"]
        self.teamComboOptions = []
        self.teamComboOptionsI = []
        self.roundComboOptions = []
        self.videoWt = 120
        self.framesFound = 0
        self.isSplitting = 0

        style = ttk.Style()
        style.configure("TButton", padding=5, font=("Helvetica", "12"))
        style.configure("Player.TButton",
                        pady=0,
                        padx=0,
                        font=("Helvetica", "12"))
        style.configure("Split.TButton",
                        padx=5,
                        pady=20,
                        font=("Helvetica", "12"))
        style.configure("TProgressbar", pady=5)
        style.configure("SplitSelected.TButton",
                        padding=5,
                        background="green",
                        activebackground="yellow",
                        highlightbackground="yellow",
                        font=("Helvetica", "20"))
        style.configure("Error.SplitSelected.TButton",
                        padding=5,
                        background="red",
                        activebackground="red",
                        highlightbackground="red",
                        font=("Helvetica", "20"))
        self.parent = parent  # == root
        self.parent.title(title or "Skydive Or Bust Dubbing 1.0")
        self.video = expanduser(video)

        # first, top panel shows vide
        self.vWrapper = ttk.Frame(self.parent)
        self.videopanel = ttk.Frame(self.vWrapper)
        self.canvas = Tk.Canvas(self.videopanel)
        self.canvas.pack(fill=Tk.BOTH, expand=1)
        self.videopanel.pack(fill=Tk.BOTH, expand=1)
        self.vWrapper.pack(side=Tk.LEFT)
        # panel to hold buttons
        self.buttons_panel = Tk.Frame(self.vWrapper)
        self.splitting_panel = Tk.Frame(self.parent)

        compcombo = ttk.Frame(self.buttons_panel)
        self.compCombo = ttk.Combobox(compcombo, width=25)
        self.compCombo['values'] = self.compComboOptions

        self.teamCombo = ttk.Combobox(compcombo, width=25)
        self.roundCombo = ttk.Combobox(compcombo, width=25)
        self.compCombo.pack(side=Tk.TOP)
        self.teamCombo.pack(side=Tk.TOP)
        self.roundCombo.pack(side=Tk.TOP)
        compcombo.pack(side=Tk.BOTTOM, fill=Tk.X)

        self.compCombo.bind('<<ComboboxSelected>>',
                            lambda event: self.change_comp())

        buttons = ttk.Frame(self.buttons_panel)
        self.openButton = ttk.Button(buttons,
                                     text="Open",
                                     command=self.OnOpen,
                                     style="Player.TButton")
        self.playButton = ttk.Button(buttons,
                                     text="Play",
                                     command=self.OnPlay,
                                     style="Player.TButton")
        stop = ttk.Button(buttons,
                          text="Stop",
                          command=self.OnStop,
                          style="Player.TButton")
        eject = ttk.Button(buttons,
                           text="Eject",
                           command=self.OnEject,
                           style="Player.TButton")

        self.slateButton = ttk.Button(self.splitting_panel,
                                      text="Slate",
                                      command=self.onMarkSlate,
                                      style="Split.TButton")
        self.exitButton = ttk.Button(self.splitting_panel,
                                     text="Exit",
                                     command=self.onMarkExit,
                                     style="Split.TButton")
        self.uploadButton = ttk.Button(self.splitting_panel,
                                       text="Upload",
                                       command=self.onUpload,
                                       style="Split.TButton")

        self.statusLabelH = ttk.Label(self.splitting_panel,
                                      text="Video Status:")
        self.progressBar = ttk.Progressbar(self.splitting_panel,
                                           orient=Tk.HORIZONTAL,
                                           length=200,
                                           mode='determinate',
                                           style="TProgressbar")
        self.wtLabel = ttk.Label(self.splitting_panel,
                                 text=str(self.videoWt) + "sec Working Time")
        self.statusLabel = ttk.Label(self.splitting_panel, text="Open Video")

        self.openButton.pack(side=Tk.LEFT)
        self.playButton.pack(side=Tk.LEFT)
        stop.pack(side=Tk.LEFT)
        eject.pack(side=Tk.LEFT)
        self.slateButton.pack(side=Tk.TOP)
        self.exitButton.pack(side=Tk.TOP)
        self.uploadButton.pack(side=Tk.TOP)

        self.statusLabelH.pack(side=Tk.TOP)
        self.progressBar.pack(side=Tk.TOP)
        self.wtLabel.pack(side=Tk.TOP)
        self.statusLabel.pack(side=Tk.TOP)
        buttons.pack(side=Tk.BOTTOM, fill=Tk.X)

        # panel to hold player time slider
        timers = ttk.Frame(self.buttons_panel)
        self.timeVar = Tk.DoubleVar()
        self.timeSliderLast = 0
        self.timeSlider = Tk.Scale(timers,
                                   variable=self.timeVar,
                                   command=self.OnTime,
                                   from_=0,
                                   to=1000,
                                   orient=Tk.HORIZONTAL,
                                   length=400,
                                   showvalue=0)  # label='Time',
        self.timeSlider.pack(side=Tk.BOTTOM, fill=Tk.X, expand=1)
        self.timeSliderUpdate = time.time()
        timers.pack(side=Tk.BOTTOM, fill=Tk.X)

        self.buttons_panel.pack(fill=Tk.BOTH, expand=1)
        self.splitting_panel.pack(fill=Tk.BOTH, expand=1)

        # VLC player
        args = []
        args.append('--no-xlib')
        self.Instance = vlc.Instance(args)
        self.player = self.Instance.media_player_new()
        self.player.audio_set_volume(0)

        self.parent.bind("<Configure>",
                         self.OnConfigure)  # catch window resize, etc.
        self.parent.update()

        # After parent.update() otherwise panel is ignored.
        # self.buttons_panel.overrideredirect(True)

        # Estetic, to keep our video panel at least as wide as our buttons panel.
        # self.parent.minsize(width=600, height=450)

        self.is_buttons_panel_anchor_active = False

        # Download API Data
        self.get_comps()
        self.list_comps()

        self.OnTick()  # set the timer up
コード例 #9
0
            target.payload.payload.forge_reset()
            attack_socket.send(target.raw())

            with stats_lock:
                stats["attacks"] += 1

        attack_event.clear()

    attack_socket.close()


listen_thread = threading.Thread(target=listen, name="listen", daemon=True)
listen_thread.start()

y = ttk.Combobox(x, height=6, values=attack_targets)
y.pack()


def button():
    return y.get()


attack = Button(x, text="attack", command=button)

attack.pack()

attack_thread = threading.Thread(target=attack, name="attack", daemon=True)
attack_thread.start()

#gui get data
コード例 #10
0
    def create_buttons(self):
        #		Tkinter.Button(self, text=" > ", command=self.next_image).place(x=(self.winfo_screenwidth()/1.1),y=(self.winfo_screenheight()/2))
        #		Tkinter.Button(self, text=" < ", command=self.previous_image).place(x=20,y=(self.winfo_screenheight()/2))
        yt = 50
        Tkinter.Button(self,
                       text="Src Img",
                       command=self.show_src,
                       height=2,
                       width=10).place(x=400, y=yt)
        Tkinter.Button(self,
                       text="Src + GT",
                       command=self.show_s_gt,
                       height=2,
                       width=10).place(x=530, y=yt)
        Tkinter.Button(self,
                       text="Src + AI",
                       command=self.show_s_ai,
                       height=2,
                       width=10).place(x=660, y=yt)
        Tkinter.Button(self,
                       text="GT vs AI",
                       command=self.show_gt_vs_ai,
                       height=2,
                       width=10).place(x=790, y=yt)
        Tkinter.Button(self,
                       text="Refresh",
                       command=self.refresh,
                       height=2,
                       width=10).place(x=920, y=yt)
        self.opt = ttk.Combobox(self,
                                values=self.OptionList,
                                height=20,
                                width=50)
        self.opt.place(x=640, y=20, anchor='center')
        self.opt.bind("<<ComboboxSelected>>", self.ComboboxSelectedFunc)

        sx = 20
        sy = 150
        self.current_csv_file = self.create_text(10 + sx,
                                                 -10 + sy,
                                                 anchor="nw",
                                                 text="current_csv_file: ")
        self.idxAI_eqq_idxGT = self.create_text(10 + sx,
                                                10 + sy,
                                                anchor="nw",
                                                text="idxAI_eqq_idxGT: ")
        self.err_mad = self.create_text(10 + sx,
                                        30 + sy,
                                        anchor="nw",
                                        text="err_mad: ")
        self.err_mean = self.create_text(10 + sx,
                                         50 + sy,
                                         anchor="nw",
                                         text="err_mean:")
        self.correct_pixels = self.create_text(10 + sx,
                                               90 + sy,
                                               anchor="nw",
                                               text="correct_pixels:")
        self.wrong_pixels = self.create_text(10 + sx,
                                             110 + sy,
                                             anchor="nw",
                                             text="wrong_pixels:")
        self.tested_pixels = self.create_text(10 + sx,
                                              130 + sy,
                                              anchor="nw",
                                              text="tested_pixels:")
        self.accuracy = self.create_text(10 + sx,
                                         150 + sy,
                                         anchor="nw",
                                         text="accuracy:")

        self['bg'] = "white"
        return
コード例 #11
0
    def init(self):
        root = self.root
        panel_frame = Frame(root, height=0.1 * self.full_h, bg='gray')
        panel_frame.pack(side='top', fill='x')

        self.canvas.pack()
        self.canvas.pack(side='bottom', fill='both', expand=1)

        quit_btn = Button(panel_frame, text='Quit')

        self.result_label = Label(panel_frame, textvariable=self.res_text, text='Result')
        self.all_points_label = Label(panel_frame, textvariable=self.all_points_text, text='Points:')

        quit_btn.bind("<Button-1>", self.close_window)

        quit_btn.place(
            x=0.01 * self.full_w,
            y=0.01 * self.full_h,
            width=0.07 * self.full_w,
            height=0.06 * self.full_h
        )

        self.result_label.place(
            x=0.11 * self.full_w,
            y=0.01 * self.full_h,
            width=0.07 * self.full_w,
            height=0.06 * self.full_h
        )

        list1 = ["Ear/Coloring", "Ear/Segment", "Seidel/Segment"]#, "Seidel/Color"]
        self.method_combo = ttk.Combobox(
            panel_frame,
            values=list1,
            style='Kim.TButton',
            justify='center',
            foreground='#FF0000',
            state='readonly'
        )

        self.method_combo.place(
            x=0.21 * self.full_w,
            y=0.01 * self.full_h,
            width=0.07 * self.full_w,
            height=0.04 * self.full_h
        )

        self.method_combo.bind('<<ComboboxSelected>>', self.change_solution_method)

        self.generate_button = Button(
            panel_frame,
            text='Generate'
        )

        self.generate_button.bind("<Button-1>", self.generate_new_poly)

        self.generate_button.place(
            x=0.31 * self.full_w,
            y=0.01 * self.full_h,
            width=0.07 * self.full_w,
            height=0.06 * self.full_h
        )

        self.all_points_label.place(
            x=0.41 * self.full_w,
            y=0.01 * self.full_h,
            width=0.07 * self.full_w,
            height=0.06 * self.full_h
        )

        var = IntVar()
        self.show_decomposition_checkbox = ttk.Checkbutton(
            panel_frame,
            text='Show decomposition',
            variable=var
        )
        self.show_decomposition_checkbox.var = var

        self.show_decomposition_checkbox.place(
            x=0.51 * self.full_w,
            y=0.01 * self.full_h,
            width=0.10 * self.full_w,
            height=0.06 * self.full_h
        )