当前位置: 首页>>代码示例>>Python>>正文


Python Combobox.pack方法代码示例

本文整理汇总了Python中tkinter.ttk.Combobox.pack方法的典型用法代码示例。如果您正苦于以下问题:Python Combobox.pack方法的具体用法?Python Combobox.pack怎么用?Python Combobox.pack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tkinter.ttk.Combobox的用法示例。


在下文中一共展示了Combobox.pack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: AlgoSelGroup

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import pack [as 别名]
class AlgoSelGroup(Group):
    def __init__(self, *args, **kwargs):
        self._topwin  = kwargs.pop('topwin')
        super().__init__(*args, **kwargs)
        
        self.__algorithm_list = Combobox(self, value=[], takefocus=1, stat='readonly', width=12)
        self.__algorithm_list['values']   = []
        self.__algorithm_list.pack()
        self.__algorithm_list.bind('<<ComboboxSelected>>', self._on_algorithm_change)
        
        Button(self, text='Load Algorithm', command=self._on_load_algorithm).pack()
        Button(self, text='Reload', command=self._on_reload_algorithm).pack()
        
        self.name = 'Algorithms'          
        
        
    @property
    def algorithm_list(self):
        return self.__algorithm_list
        
        
    def _on_algorithm_change(self, event):
        self._topwin.change_algorithm(event.widget.get())
        
        
    def _on_load_algorithm(self):        
        new_thread_do = self._topwin.root_node.thread_manager.new_thread_do
        main_thread_do = self._topwin.root_node.thread_manager.main_thread_do
    
        @new_thread_do
        def select_and_load():
            class_info = ask_class_name('wavesynlib.algorithms', Algorithm)
            if not class_info:
                return
            module_name, class_name = class_info
            if isinstance(module_name, bytes):
                module_name = module_name.decode('utf-8')
            if isinstance(class_name, bytes):
                class_name = class_name.decode('utf-8')
            @main_thread_do()
            def load():
                with code_printer():
                    self._topwin.load_algorithm(module_name=module_name, class_name=class_name)
            
            
    def _on_reload_algorithm(self):
        with code_printer():
            self._topwin.current_algorithm.reload_algorithm()
开发者ID:xialulee,项目名称:WaveSyn,代码行数:50,代码来源:singlesyn.py

示例2: _makesetting

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import pack [as 别名]
def _makesetting(setting_window, conf):
    setting_label = Label(setting_window,
                          text=_('Setting'),
                          font=('courier', 20, 'bold'))
    setting_label.pack(side=TOP)

    style_container = Frame(setting_window)
    style_container.pack(side=TOP)
    style_label = Label(style_container,
                        text=_('Display wallpaper in style: '),
                        font=('courier', 15, 'bold'))
    style_label.pack(side=LEFT)
    style_combobox = Combobox(style_container)
    available_style = {'3': 'zoom', '2': 'scaled', '1': 'stretched', '0': 'centered', '4': 'wallpaper'}
    style_combobox['value'] = (_('centered'), _('stretched'), _('scaled'), _('zoom'), _('wallpaper'))
    style_combobox.state(['readonly'])
    style_combobox.current(int(conf['style']))
    style_combobox.pack(side=LEFT)

    random_container = Frame(setting_window)
    random_container.pack(side=TOP)
    random_label = Label(random_container,
                         text=_('Choose wallpaper randomly? '),
                         font=('courier', 15, 'bold'))
    random_label.pack(side=LEFT)
    random_checkbutton = Checkbutton(random_container)
    random_checkbutton.pack(side=LEFT)
    if conf['random'] == "1":
        random_checkbutton.select()

    interval_container = Frame(setting_window)
    interval_container.pack(side=TOP)
    interval_label = Label(interval_container,
                           text=_('Change wallpaper every '),
                           font=('courier', 15, 'bold'))
    interval_label.pack(side=LEFT)
    interval_text = Text(interval_container, height=1, width=4)
    interval_text.insert(END, conf['interval'])
    interval_text.pack(side=LEFT)
    minute_label = Label(interval_container,
                         text=_(' minutes.'),
                         font=('courier', 15, 'bold'))
    minute_label.pack(side=LEFT)
开发者ID:funagi,项目名称:wallpapoz,代码行数:45,代码来源:wallpapoz_main_window.py

示例3: adb_Main

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import pack [as 别名]
    def adb_Main(self):
        vcheck.auto_version_check()
        adbmain_frame = LabelFrame(self.parent, text="ADB Main function:", padx=3, pady=3)
        adbmain_frame.grid(column=0, row=2)

        check_device = Button(adbmain_frame, text="Check Device", command=lambda: adb("devices"),width=buttonw)
        check_device.pack(padx=2, pady=2)

        reboot = Button(adbmain_frame, text="Reboot", command=lambda: self.comboget(),width=buttonw)
        reboot.pack(padx=2, pady=2)

        global v
        v = StringVar()  # a string variable to hold user selection
        options = ["Normal", "Recovery", "Bootloade"]  # available combobox options
        combo = Combobox(adbmain_frame, textvariable=v, values=options, width=buttonw)
        #combo.bind('<<ComboboxSelected>>', self.comboget)  # binding of user selection with a custom callback
        combo.current(0)  # set as default "option 2"
        combo.pack()

        reboot_recovery = Button(adbmain_frame, text="Start Service", command=lambda: adb("start-server", after_print_text="Service startet"), width=buttonw)
        reboot_recovery.pack(padx=2, pady=2)

        reboot_bootloader = Button(adbmain_frame, text="Stop Service", command=lambda: adb("kill-server", after_print_text="Service Stopt"), width=buttonw)
        reboot_bootloader.pack(padx=2, pady=2)
开发者ID:mrchaosbude,项目名称:Android-Easy-Backup,代码行数:26,代码来源:Android+Easy+Backup.py

示例4: SimUI

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import pack [as 别名]
class SimUI(object):
    def __init__(self, manager, fake_time, config_obj):
        """
            initializes all default values and creates 
            a board, waits for run() to be called
            to start the board
            
            manager - sim manager class instance
        """

        self.manager = manager
        self.fake_time = fake_time
        self.config_obj = config_obj

        # Set up idle_add
        self.queue = queue.Queue()

        self.root = tk.Tk()
        self.root.wm_title("PyFRC Robot Simulator v%s" % __version__)

        # setup mode switch
        frame = tk.Frame(self.root)
        frame.pack(side=tk.TOP, anchor=tk.W)

        self._setup_widgets(frame)

        self.root.resizable(width=0, height=0)

        self.mode_start_tm = 0
        self.text_id = None

        # connect to the controller
        self.manager.on_mode_change(lambda mode: self.idle_add(self.on_robot_mode_change, mode))
        self.on_robot_mode_change(self.manager.get_mode())

        # create pygame joystick if supported
        try:
            from .pygame_joysticks import UsbJoysticks
        except ImportError:
            logger.warn("pygame not detected, real joystick support not loaded")
            self.usb_joysticks = None
        else:
            self.usb_joysticks = UsbJoysticks(self)
            logger.info("pygame was detected, real joystick support loaded!")

        try:
            self.root.lift()
            self.root.attributes("-topmost", True)
            self.root.attributes("-topmost", False)
        except Exception:
            pass

        self.timer_fired()

    def _setup_widgets(self, frame):

        top = tk.Frame(frame)
        top.grid(column=0, row=0)

        bottom = tk.Frame(frame)
        bottom.grid(column=0, row=1)

        self.field = RobotField(frame, self.manager, self.config_obj)
        self.field.grid(column=1, row=0, rowspan=2)

        # status bar
        self.status = tk.Label(frame, bd=1, relief=tk.SUNKEN, anchor=tk.E)
        self.status.grid(column=0, row=2, columnspan=2, sticky=tk.W + tk.E)

        # analog
        slot = tk.LabelFrame(top, text="Analog")
        self.analog = []

        for i in range(len(hal_data["analog_in"])):
            if hal_data["analog_in"][i]["initialized"] or hal_data["analog_out"][i]["initialized"]:
                label = tk.Label(slot, text=str(i))
                label.grid(column=0, row=i + 1)

                vw = ValueWidget(slot, clickable=True, minval=-10.0, maxval=10.0)
                vw.grid(column=1, row=i + 1)
                self.set_tooltip(vw, "analog", i)
            else:
                vw = None

            self.analog.append(vw)

        slot.pack(side=tk.LEFT, fill=tk.Y, padx=5)

        # digital
        slot = tk.LabelFrame(top, text="Digital")

        label = tk.Label(slot, text="PWM")
        label.grid(column=0, columnspan=4, row=0)
        self.pwm = []

        for i in range(len(hal_data["pwm"])):
            if hal_data["pwm"][i]["initialized"]:
                c = i // 10

                label = tk.Label(slot, text=str(i))
#.........这里部分代码省略.........
开发者ID:Twinters007,项目名称:pyfrc,代码行数:103,代码来源:ui.py

示例5: makeentry

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import pack [as 别名]
def makeentry(parent, caption, width=None, **options):
    Label(parent, text=caption).pack(side=LEFT)
    entry = Entry(parent, **options)
    if width:
        entry.config(width=width)
    entry.pack(side=LEFT)
    return entry
#
# user = makeentry(root, "User name:", 10)
# password = makeentry(root, "Password:", 10, show="*")
#
# def login_clicked():
#     print(user.get(), password.get())
#
# login = Button(root, text="Login", command=login_clicked, height="5")
# login.pack(fill=BOTH) # îòîáðàçèòü íà îêíå

def set(*args):
    print(combo.get())
    e.delete(0, END)
    e.insert(0, combo.get())

combo = Combobox(root, values=['1', '2', '3'], state='readonly')
combo.bind('<<ComboboxSelected>>', set)
combo.pack()


root.protocol('WM_DELETE_WINDOW', close) # çàêðîåòñÿ ïðèëîæåíèå ïî çàêðûòèþ îêíà

root.mainloop() # çàïóñêàåì ïðîãðàììó
开发者ID:ginbeard,项目名称:HomeworkStorage,代码行数:32,代码来源:TKmodule.py

示例6: LevelWindow

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import pack [as 别名]
class LevelWindow(object):
    """Fenêtre de configuration du niveau de l'algorithme"""
    def __init__(self, parent):
        # Dictionnaire contenant les paramètres
        self.lv_param={}
        self.lv_param['niveau'] = 5
        self.lv_param['seuil'] = 60
        self.lv_param['échantillons'] = 100

        # Initialisation et création de la fenêtre
        self.window = Toplevel(parent)
        self.window.geometry("580x160")
        self.window.title("Paramètres")
        self.window.resizable(False, False)
        self.window.protocol("WM_DELETE_WINDOW", self.valide)
        self.window.bind("<Return>", self.valide)

        Label(self.window,text="Niveau de l'algorithme",font=(FONT, 16)).pack(pady=5)

        self.frame_param = Frame(self.window)
        self.frame_param.pack(fill=BOTH, padx=10, pady=10)

        # Choix du niveau
        self.cb_lv = Combobox(self.frame_param, values=["Niveau 1", "Niveau 2", "Niveau 3", "Niveau 4", "Niveau 5", "Niveau 6"], state="readonly")
        self.cb_lv.pack(side=LEFT)
        self.cb_lv.current(4)
        self.cb_lv.bind("<<ComboboxSelected>>", self.on_cb_change)

        # Paramètres supplémentaires
        self.lb_param = Label(self.frame_param, text="")
        self.txt_param = Text(self.frame_param, height=1, width=6)
        self.txt_param.insert(END, "0")

        # Informations sur les niveaux
        self.infos_niveaux = ["Niveau 1 : Que des tirs aléatoires uniformes sans file d'attente",
                              "Niveau 2 : Tirs aléatoires uniformes et file d'attente",
                              "Niveau 3 : Tirs aléatoires sur les cases noires et file d'attente",
                              "Niveau 4 : Optimisation par des échantillons",
                              "Niveau 5 : Optimisation par nombre de bateaux local",
                              "Niveau 6 : Optimisation par énumération de tous les arrangements à partir d'un seuil"]
        frame_infos = Frame(self.window)
        frame_infos.pack(fill=X)
        self.lb_info = Label(frame_infos, justify=LEFT,  pady=5)
        self.lb_info['text'] = self.infos_niveaux[self.cb_lv.current()]
        self.lb_info.pack(side=LEFT, padx=10)

        Button(self.window, text="Valider", command=self.valide).pack(side=BOTTOM, pady=5)

    def on_cb_change(self, event=None) :
        """Quand on change le niveau"""
        self.cb_lv.selection_clear()
        niveau = self.cb_lv.current()+1
        self.lv_param['niveau'] = niveau
        self.lb_info['text'] = self.infos_niveaux[self.cb_lv.current()]

        # Pour les niveaux 4 et 6, paramètres supplémentaires
        if niveau == 4 :
            self.lb_param['text'] = "Échantillons : "
            self.txt_param.delete('1.0', END)
            self.txt_param.insert(END, "100")
            self.lb_param.pack(side=LEFT, padx=10)
            self.txt_param.pack(side=LEFT)
        elif niveau == 6 :
            self.lb_param['text'] = "Seuil : "
            self.txt_param.delete('1.0', END)
            self.txt_param.insert(END, "60")
            self.lb_param.pack(side=LEFT, padx=10)
            self.txt_param.pack(side=LEFT)
        else :
            self.lb_param.pack_forget()
            self.txt_param.pack_forget()

    def valide(self, event=None):
        """Validation des paramètres"""
        self.lv_param['seuil'] = int(self.txt_param.get('1.0', END)[:-1])
        self.lv_param['échantillons'] = int(self.txt_param.get('1.0', END)[:-1])
        self.window.destroy()
开发者ID:Abunux,项目名称:pyBatNav,代码行数:79,代码来源:bn_tkinter.py

示例7: SimUI

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import pack [as 别名]
class SimUI(object):
    def __init__(self, manager, fake_time, config_obj):
        """
            initializes all default values and creates
            a board, waits for run() to be called
            to start the board
            
            manager - sim manager class instance
        """

        self.manager = manager
        self.fake_time = fake_time
        self.config_obj = config_obj

        # Set up idle_add
        self.queue = queue.Queue()

        self.root = tk.Tk()
        self.root.wm_title("PyFRC Robot Simulator v%s" % __version__)

        self.root.protocol("WM_DELETE_WINDOW", self._delete_window)

        # setup mode switch
        frame = tk.Frame(self.root)
        frame.pack(side=tk.TOP, anchor=tk.W)

        self._setup_widgets(frame)

        self.root.resizable(width=0, height=0)

        # Allow extending the simulation from 3rd party libraries
        # -> TODO: better API for this
        self.extensions = []
        for ep in iter_entry_points(group="robotpysim", name=None):
            try:
                extension = ep.load()
            except ImportError:
                logger.debug("Error importing extension '%s'", ep.name, exc_info=True)
            else:
                logger.debug("Loaded simulation extension '%s'", ep.name)
                extension = extension()

                if hasattr(extension, "update_tk_widgets"):
                    self.extensions.append(extension)

        self.mode_start_tm = 0
        self.text_id = None

        # connect to the controller
        self.manager.on_mode_change(
            lambda mode: self.idle_add(self.on_robot_mode_change, mode)
        )
        self.on_robot_mode_change(self.manager.get_mode())

        # create pygame joystick if supported
        try:
            from .pygame_joysticks import UsbJoysticks
        except ImportError:
            logger.warn("pygame not detected, real joystick support not loaded")
            self.usb_joysticks = None
        else:
            self.usb_joysticks = UsbJoysticks(self)
            logger.info("pygame was detected, real joystick support loaded!")

        try:
            self.root.lift()
            self.root.attributes("-topmost", True)
            self.root.attributes("-topmost", False)
        except Exception:
            pass

        self.timer_fired()

    def _delete_window(self):
        self.root.destroy()
        if self.usb_joysticks is not None:
            self.usb_joysticks.close()

    def _setup_widgets(self, frame):

        top = tk.Frame(frame)
        top.grid(column=0, row=0)

        bottom = tk.Frame(frame)
        bottom.grid(column=0, row=1)

        self.field = RobotField(frame, self.manager, self.config_obj)
        self.field.grid(column=1, row=0, rowspan=2)

        # status bar
        self.status = tk.Label(frame, bd=1, relief=tk.SUNKEN, anchor=tk.E)
        self.status.grid(column=0, row=2, columnspan=2, sticky=tk.W + tk.E)

        # analog
        slot = tk.LabelFrame(top, text="Analog")
        self.analog = []

        for i in range(len(hal_data["analog_in"])):
            if (
                hal_data["analog_in"][i]["initialized"]
#.........这里部分代码省略.........
开发者ID:robotpy,项目名称:pyfrc,代码行数:103,代码来源:ui.py

示例8: cbox_do

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import pack [as 别名]
from tkinter import *
from tkinter.ttk import Combobox

def cbox_do(event):
    'Used for cbox.'
    clabel.config(text=cbox.get())

a = Tk()
cbox = Combobox(a, value=('Luke','Biggs','Wedge'), takefocus=0)
cbox.bind("<<ComboboxSelected>>", cbox_do)
cbox.pack()
clabel = Label(a)
clabel.pack()
a.mainloop()

master = Tk()
variable = StringVar(master)
variable.set("one")
w = Combobox(master, textvariable=variable, values=["one", "two", "three"])
w.pack()

master.mainloop()
开发者ID:guochangjiang,项目名称:Python.learn,代码行数:24,代码来源:tk.draw.down.box3.py

示例9: __init__

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import pack [as 别名]
class FenOptions:
    def __init__(self):
        self.root=Tk()
        self.root.title('Donjon & Python-Option')
        self.root.bind('<F12>', switchDebug)
        #--------Barres de volume------#
        self.varVolumeGlobal = IntVar()
        self.varVolumeGlobal.set(Audio.volumeGlobal)
        self.varVolumeMusique = IntVar()
        self.varVolumeMusique.set(Audio.volumeMusic)
        self.varVolumeSons = IntVar()
        self.varVolumeSons.set(Audio.volumeSound)
        self.scaleVolumeGlobal = Scale(self.root,from_=0,
                                        to=100,resolution=1,
                                        orient=HORIZONTAL,
                                        length=300,width=20,
                                        label="Volume principal",
                                        tickinterval=20,
                                        variable=self.varVolumeGlobal,
                                        command = self.setVolumeGlobal)
        self.scaleVolumeMusique = Scale(self.root,from_=0,
                                        to=100,resolution=1,orient=HORIZONTAL,
                                        length=300,
                                        width=20,
                                        label="Volume Musique",
                                        tickinterval=20,
                                        variable=self.varVolumeMusique,
                                        command = self.setVolumeMusique)
        self.scaleVolumeSons = Scale(self.root,
                                        from_=0,
                                        to=100,
                                        resolution=1,
                                        orient=HORIZONTAL,
                                        length=300,
                                        width=20,
                                        label="Volume Bruitages",
                                        tickinterval=20,
                                        variable=self.varVolumeSons,
                                        command = self.setVolumeSons)
        self.scaleVolumeGlobal.set(Audio.volumeGlobal)
        self.scaleVolumeMusique.set(Audio.volumeMusic)
        self.scaleVolumeSons.set(Audio.volumeSound)
        self.scaleVolumeGlobal.pack(padx=10,pady=10)
        self.scaleVolumeMusique.pack(padx=10,pady=10)
        self.scaleVolumeSons.pack(padx=10,pady=10)
        #-----Sélection des textures----#
        Label(self.root, text='Texture Pack :').pack()
        self.box = Combobox(self.root, values=listdir('TexturePack'), state='readonly')
        self.box.bind('<<ComboboxSelected>>', self.selectionnerPack)
        self.box.current(0)
        self.box.pack()
    def selectionnerPack(self, event) :
        global texturePack
        texturePack = self.box.get()
    def run(self):
        self.root.mainloop()
        Audio.volumeGlobal = volume
        Audio.setVolumeMusic()
    def setVolumeGlobal(self, volume):
        Audio.volumeGlobal = volume
        Audio.setVolumeMusic()
    def setVolumeMusique(self, volume):
        Audio.volumeMusic = volume
        Audio.setVolumeMusic()
    def setVolumeSons(self, volume):
        Audio.volumeSound = volume
开发者ID:Hugal31,项目名称:Donjon-Python,代码行数:68,代码来源:Options.py

示例10: Tree

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import pack [as 别名]
tree1 = None
tree2 = None
tree3 = None

place1_occupied = False
place2_occupied = False
place3_occupied = False

window = tkinter.Tk()
window.bind('<Configure>', windowdrag)
canvas = tkinter.Canvas(window, height=WINDOW_HEIGHT, width=WINDOW_WIDTH, bg='#bbe')

# tree = Tree(TREE_INITIAL_BASE_X, TREE_INITIAL_BASE_Y, TREE_INITIAL_SIZE)
tool_panel = tkinter.Frame(window, height=50, width=300)
tool_panel.pack()
tree_size_label = tkinter.Label(tool_panel, text='tree size: ')
tree_size_label.pack(side=tkinter.LEFT)
tree_size_combobox = Combobox(tool_panel, state='readonly', values=['1', '2', '3', '4'], width=10)
tree_size_combobox.pack()
grass = canvas.create_rectangle(0, GRASS_BOTTOM, WINDOW_WIDTH, GRASS_TOP, fill='#5e5')
canvas.tag_bind(grass, '<ButtonPress-1>', make_tree)
# tree.generate_apple()
# threading.Thread(target=tree.generate_apple).start()

canvas.pack()

window.mainloop()


开发者ID:assadge,项目名称:tkinter_drawing_trees,代码行数:29,代码来源:tree.py

示例11: run_with_gui

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import pack [as 别名]
def run_with_gui():
    root = Tk()
    root.title("PyEncConv")

    def browse_in():
        name = askopenfilename()
        if name:
            in_txt.delete(0, END)
            in_txt.insert(END, name)

    def browse_out():
        name = asksaveasfilename()
        if name:
            out_txt.delete(0, END)
            out_txt.insert(END, name)

    # input file
    f = Frame(root)
    f.pack(anchor=W, fill=X)
    Label(f, text="input file:").pack(side=LEFT)
    in_txt = Entry(f)
    in_txt.pack(fill=X, expand=True, side=LEFT)
    in_browse = Button(f, text="browse...", command=browse_in)
    in_browse.pack(side=LEFT)

    def load_file():
        try:
            txt_area.delete(1.0, END)
            in_enc = in_enc_cmb.get()
            in_alias_lbl.config(text=(' '.join(get_alt_names(in_enc))))

            with open(in_txt.get(), 'r', encoding=in_enc) as f:
                txt_area.insert(END, f.read())
        except IOError as e:
            txt_area.insert(END, str(e))
        except OSError as e:
            txt_area.insert(END, str(e))
        except LookupError as e:
            txt_area.insert(END, str(e))
        except Exception as e:
            txt_area.insert(END, str(e))

    # input encoding
    f = Frame(root)
    f.pack(anchor=W, fill=X)
    Label(f, text="input encoding:").pack(side=LEFT)
    in_enc_cmb = Combobox(f)
    in_enc_cmb.pack(side=LEFT)
    in_enc_cmb['values'] = enc_set
    in_enc_cmb.insert(END, getpreferredencoding())
    in_enc_cmb.bind('<Return>', lambda event:load_file())
    in_alias_lbl = Label(f)
    in_alias_lbl.pack(side=LEFT)

    Button(root, text="Load for preview", command=load_file).pack(anchor=W)

    def disable_output_file():
        out_txt.config(state=DISABLED)
        out_browse.config(state=DISABLED)

    def enable_output_file():
        out_txt.config(state=NORMAL)
        out_browse.config(state=NORMAL)

    # output file
    out_choice = IntVar(value=1)
    Radiobutton(root, text="overwrite original (after moving to .bak)",
            variable = out_choice, value=1,
            command=disable_output_file).pack(anchor=W)
    f = Frame(root)
    f.pack(anchor=W, fill=X)
    Radiobutton(f, text="output file:",
            variable = out_choice, value=2,
            command=enable_output_file).pack(side=LEFT)
    out_txt = Entry(f, state=DISABLED)
    out_txt.pack(fill=X, expand=True, side=LEFT)
    out_browse = Button(f, text="browse...", command=browse_out,
            state=DISABLED)
    out_browse.pack(side=LEFT)

    # output encoding
    f = Frame(root)
    f.pack(anchor=W, fill=X)
    Label(f, text="output encoding:").pack(side=LEFT)
    out_enc_cmb = Combobox(f)
    out_enc_cmb.pack(side=LEFT)
    out_enc_cmb['values'] = enc_set
    out_enc_cmb.insert(END, 'UTF-8')
    out_alias_lbl = Label(f)
    out_alias_lbl.pack(side=LEFT)

    def convert():
        try:
            txt_area.delete(1.0, END)
            in_enc = in_enc_cmb.get()
            in_alias_lbl.config(text=(' '.join(get_alt_names(in_enc))))
            out_enc = out_enc_cmb.get()
            out_alias_lbl.config(text=(' '.join(get_alt_names(out_enc))))

            src_file = in_txt.get()
#.........这里部分代码省略.........
开发者ID:lululeta2014,项目名称:mihaib,代码行数:103,代码来源:gui.py

示例12: __init__

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import pack [as 别名]
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        timer = TkTimer(widget=self, interval=200, active=False)
        
        self.__battery_images = battery_images = {}
        image_dir = Path(Scripting.root_node.get_gui_image_path('battery'))
        for image_name in ['10per', '25per', '50per', '75per', '100per',
                           '10per_charge', '25per_charge', 
                           '50per_charge', '75per_charge', '100per_charge']:
            battery_images[image_name] = ImageTk.PhotoImage(
                file=str(image_dir/(image_name+'.png')))
            
        self.__busy_images = busy_images = {}
        image_dir = Path(Scripting.root_node.get_gui_image_path('busysignal'))
        busy_images['busy'] = ImageTk.PhotoImage(file=str(image_dir/('busy'+'.png')))
        busy_images['available'] = ImageTk.PhotoImage(file=str(image_dir/('available'+'.png')))

        balloon = Scripting.root_node.gui.balloon
                        
        self.__busy_lamp = busy_lamp = Label(self)
        busy_lamp['image'] = busy_images['available']
        busy_lamp.pack(side='right', fill='y')
        
        balloon.bind_widget(busy_lamp, balloonmsg='''Main-thread status.
Green: main-thread is available;
Red:   main-thread is busy.''')
        
        battery_meter = Label(self)
        battery_meter.pack(side='right', fill='y')
        battery_meter_tip = balloon.bind_widget(battery_meter, balloonmsg='Battery: ')
        def battery_meter_tip_show_callback():
            battery_status = Scripting.root_node.interfaces.os.get_battery_status()
            if battery_status is None:
                return 'No battery detected.'
            else:
                return f'{battery_status.percent}%'
        battery_meter_tip.show_callback = battery_meter_tip_show_callback
        
        self.__membar = IntVar(0)
        self.__cpubar = IntVar(0)
        self._make_cpu_mem_status()

        # Transparent Scale {
        def on_scale(val):
            Scripting.root_node.gui.console.set_opacity(val)
        trans_scale = Scale(self, from_=0.2, to=1.0, orient='horizontal', value=1, command=on_scale)
        trans_scale.pack(side='right')
        balloon.bind_widget(trans_scale, balloonmsg='Set the opacity of the console.')
        # } End Transparent Scale

        # Topmost Button {
        import tkinter
        topmost_button = tkinter.Button(self, text='TOP', relief='groove') 
        topmost_button.pack(side='right')
        
        def on_click():
            console =Scripting.root_node.gui.console
            b = console.is_topmost
            fg = 'black' if b else 'lime green'
            topmost_button['fg'] = fg
            with code_printer(True):
                console.set_topmost(not b)
            
        topmost_button['command'] = on_click
        balloon.bind_widget(topmost_button, balloonmsg='Set the console as a topmost window.')
        # } End Topmost Button 
        
        # Doc Button {
        docbtn = tkinter.Button(self, text='DOC', relief='groove')
        docbtn.pack(side='right')
        
        def on_click():
            docwin = Scripting.root_node.gui.console.doc_window
            with code_printer(True):
                docwin.show_window()
                
        docbtn['command'] = on_click
        balloon.bind_widget(docbtn, balloonmsg='Show document window.')
        #} End Doc Window        
        
        # Debug Button {
        debbtn = tkinter.Button(self, text='DEB', relief='groove')
        debbtn.pack(side='right')
        
        def on_click():
            debwin = Scripting.root_node.gui.console.debug_window
            with code_printer(True):
                debwin.show_window()
                
        debbtn['command'] = on_click
        balloon.bind_widget(debbtn, balloonmsg='Show debug window.')
        #} End Debug Button
        
        #{ Window Combo
        window_combo = Combobox(self, value=[], takefocus=1, stat='readonly')
        def on_selected(event):
            text = event.widget.get()
            wid = int(text.split(':')[1].strip())
            Scripting.root_node.gui.windows[wid].tk_object.deiconify()
        window_combo.bind('<<ComboboxSelected>>', on_selected)
#.........这里部分代码省略.........
开发者ID:xialulee,项目名称:WaveSyn,代码行数:103,代码来源:console.py

示例13: Application

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import pack [as 别名]
class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        root.title("NHL Stats to CSV")
        self.pack()
        self.createWidgets()

    def createWidgets(self):
        
        frame1 = Frame(self)
        season_frame = Frame(frame1)
        self.seasonlabel = Label(season_frame, text="Season")
        season_list = ('2013-2014', '2012-2013', '2011-2012', '2010-2011',
                       '2009-2010', '2008-2009', '2007-2008', '2006-2007',
                       '2005-2006', '2003-2004', '2002-2003', '2001-2002',
                       '2000-2001', '1999-2000', '1998-1999', '1997-1998')
        self.season = Combobox(season_frame, values=season_list, state='readonly')
        self.season.current(0)
        self.seasonlabel.pack()
        self.season.pack()
        season_frame.pack(side=LEFT, padx=5, pady=5)

        position_frame = Frame(frame1)
        self.positionlabel = Label(position_frame, text="Position")
        position_list = ('All Skaters', 'Goalies', 'Forwards', 'Defenseman',
                         'Center', 'Left Wing', 'Right Wing')
        self.position = Combobox(position_frame, values=position_list, state='readonly')
        self.position.current(0)
        self.positionlabel.pack()
        self.position.pack()
        position_frame.pack(side=LEFT, padx=5, pady=5)
        frame1.pack(side=TOP)

        frame2 = Frame(self)
        gameType_frame = Frame(frame2)
        self.gameTypelabel = Label(gameType_frame, text="Game Type")
        gameType_list = ('Regular Season', 'Playoffs')
        self.gameType = Combobox(gameType_frame, values=gameType_list, state='readonly')
        self.gameType.current(0)
        self.gameTypelabel.pack()
        self.gameType.pack()
        gameType_frame.pack(side=LEFT, padx=5, pady=5)

        grouping_frame = Frame(frame2)
        self.groupinglabel = Label(grouping_frame, text="Grouping")
        grouping_list = ('By League', 'By Team')
        self.grouping = Combobox(grouping_frame, values=grouping_list, state='readonly')
        self.grouping.current(0)
        self.groupinglabel.pack()
        self.grouping.pack()
        grouping_frame.pack(side=LEFT, padx=5, pady=5)
        frame2.pack(side=TOP)

        frame3 = Frame(self)
        self.progress = Label(frame3, text="Choose Options and Press Start", relief=SUNKEN, width=30)
        self.progress.pack()
        frame3.pack(side=TOP, padx=5, pady=5)

        frame4 = Frame(self)
        self.start = Button(frame4, text="Start", command=self.start)
        self.QUIT = Button(frame4, text="Quit", command=self.quit)
        self.start.pack(side=LEFT)
        self.QUIT.pack(side=LEFT)
        frame4.pack(side=TOP)

    def quit(self):
        root.destroy()

    def start(self):
        self.progress.config(text="Working...")
        season_fn = self.season.get()
        season = season_fn.replace("-", "")
        gameType = self.gameType.get()
        if gameType == "Regular Season":
            gameType = "2"
        else:
            gameType = "3"
        grouping = self.grouping.get()
        position = self.position.get()
        if position == "All Skaters":
            position = "S"
        position = position[0]

        # For csv filename
        gameTypes = {"2": "regularseason", "3": "playoffs"}

        positions = {"S": "skater", "G": "goalie", "F": "forward", "D": "defenseman",
                     "C": "center", "L": "leftwing", "R": "rightwing"}

        gameType_fn = gameTypes[gameType]
        position_fn = positions[position]
        grouping_fn = ""
        if grouping == "By League":
            grouping_fn = "byleague"
        else:
            grouping_fn = "byteam"

        self.filename = "nhl_" + season_fn + "_" + gameType_fn + "_" + position_fn + "stats" + "_" + grouping_fn + ".csv"

        # Stat column headings
#.........这里部分代码省略.........
开发者ID:lukerajnoha,项目名称:NHL-Stats-to-CSV,代码行数:103,代码来源:NHL-Stats-to-CSV.py

示例14: __init__

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import pack [as 别名]
class Panel:
    def __init__(self, frame, treater, settings):
        self.is_active = False
        self.oposite = lambda: None
        self.treater = treater
        self.placer = Placer()
        self.settings = settings
        self.sort_by = "name"
        self.sort_rev = False
        self.pwd = StringVar()
        self._places = None
        self.has_pardir = False
        self.pwd.set(self.treater.get_cur_dir())
        self.body(frame)
        ddir = join(dirname(__file__), "data")
        self.imgs = {}
        for t, f in (("directory", "folder.gif"), ("regular", "file.gif"),
                     ("link", "link.gif"), ("fifo", "fifo.gif"),
                     ("socket", "socket.gif"), ("block", "block.gif"),
                     ("character", "character.gif"),
                     ("Parent_dir", "pardir.gif")):
            self.imgs[t] = PhotoImage(master=frame, file=join(ddir, f))
        self.str_ids = {}
        self.id_range = []
        self.selected_ids = set()
        self.br_hist = []
        self.fresh()
        self.renheadings()

    def body(self, frame):
        "Place panel widgets"
        frame.grid_columnconfigure(0, weight=1)
        frame.grid_rowconfigure(1, weight=1)
        top = Frame(frame)
        top.grid(column=0, row=0, sticky="ew")
        self.mounts = Combobox(top, takefocus=False, state="readonly")
        self.mounts["postcommand"] = self.get_places
        self.mounts.bind("<<ComboboxSelected>>", self.goto_place)
        self.mounts.pack(anchor="nw")
        pthl = Label(top, textvariable=self.pwd)
        pthl.pack(expand=True, anchor="w")
        self.tree = tree = Treeview(frame,
                                    columns=("size", "modified", "mode"))
        tree.grid(column=0, row=1, sticky="nwes")
        vsb = Scrollbar(frame, command=self.tree.yview, orient="vertical")
        vsb.grid(column=1, row=1, sticky="ns")
        tree["yscrollcommand"] = lambda f, l: autoscroll(vsb, f, l)
        hsb = Scrollbar(frame, command=self.tree.xview,
                        orient="horizontal")
        hsb.grid(column=0, row=2, sticky="ew")
        tree["xscrollcommand"] = lambda f, l: autoscroll(hsb, f, l)
        tree.column("size", width=70, anchor="center")
        tree.column("modified", width=70, anchor="center")
        tree.column("mode", width=70, anchor="center")
        tree.heading("#0", command=lambda: self.on_heading("name"))
        tree.heading("size", command=lambda: self.on_heading("size"))
        tree.heading("modified", command=lambda: self.on_heading("date"))
        tree.tag_configure("selected", foreground="red")
        for i in (("<Return>", self.enter_file),
                  ("<Double-Button-1>", self.enter_file),
                  ("<Right>", self.enter_file), ("<Left>", self.go_back),
                  ("<Tab>", self.switch), ("<Home>", self.go_top),
                  ("<Button-1>", self.activate),
                  ("<Insert>", self.turn_selection),
                  ("<Control-r>", self.refresh)):
            tree.bind(*i)

    def renheadings(self):
        "Rename headings due to new sorting conditions"
        arrow_up = " \u2191"
        arrow_down = " \u2193"
        for col, name, sb in (
                ("#0", _("Name"), "name"),
                ("size", _("Size"), "size"), ("modified", _("Date"), "date"),
                ("mode", _("Attr."), None)):
            if self.sort_by == sb:
                name += arrow_down if self.sort_rev else arrow_up
            self.tree.heading(col, text=name)

    def on_heading(self, name):
        "An heading was clicked"
        if self.sort_by == name:
            self.sort_rev = not self.sort_rev
        else:
            self.sort_by = name
            self.sort_rev = False
        self.sort_tree()
        self.renheadings()

    def fresh(self):
        "Update tree items. Returns True on error."
        files = self.treater.list_visible(self.settings)
        if files is None:
            return True
        self.clear()
        self.has_pardir = self.treater.has_pardir()
        if self.has_pardir:
            self.tree.insert("", "end", "Parent_dir", text=pardir,
                             image=self.imgs["Parent_dir"])
        ltp = localtime(time())
#.........这里部分代码省略.........
开发者ID:Lysovenko,项目名称:bpc,代码行数:103,代码来源:panel.py

示例15: StringVar

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import pack [as 别名]
sliceFrame.pack(padx=10, pady=10)

settingsFrame.add(setupFrame, text="Connection")
settingsFrame.add(sliceFrame, text="Slice Settings")
printerFrame.configure(padx=10, pady = 10)
sliceFrame.configure(padx=10, pady = 10)

vMonitor = StringVar()
vComPort = StringVar()
vBaudRate = StringVar()



Label(printerFrame, text="Monitor").pack(anchor=W)
monitorSelect = Combobox(printerFrame, values = monitorList, state="readonly", textvariable=vMonitor)
monitorSelect.pack()
    

confMonitor = Button(printerFrame, text="Configure Monitor", state="disabled", command = openMonitorConfig)
confMonitor.pack(pady=5, anchor=W, fill=X)


Label(printerFrame, text="COM Port").pack(anchor=W)
comSelect = Combobox(printerFrame, values = comPortNames, state="readonly", textvariable=vComPort)
comSelect.pack()

if selectedMonIndex != -1:
    monitorSelect.current(int(selectedMonIndex))
    confMonitor.configure(state="normal")

if selectedComPortIndex != -1:
开发者ID:MattStultz,项目名称:Skylight,代码行数:33,代码来源:main.py


注:本文中的tkinter.ttk.Combobox.pack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。