コード例 #1
0
    def createOrder(frame):
        import tkinter as ttk
        meatType = ttk.Label(frame, text="Type of Meat:")
        meatType.grid(column=0, row=1, sticky=(N))
        varType = ttk.StringVar(frame)
        choices = {'Chicken', 'Lamb'}
        varType.set('Please Select...')
        popupMenu = ttk.OptionMenu(frame, varType, *choices)
        popupMenu.grid(column=2, row=1)

        meatPart = ttk.Label(frame, text="Part of Meat:")
        meatPart.grid(column=0, row=3, sticky=(N))
        varType = ttk.StringVar(frame)
        choices = {'Legs', 'Drum Sticks'}
        varType.set('Chicken')
        popupMenu = ttk.OptionMenu(frame, varType, *choices)
        popupMenu.grid(column=2, row=3)

        meatWeight = ttk.Label(frame, text="Weight of Meat:")
        meatWeight.grid(column=0, row=5, sticky=(N))
        weightEntry = ttk.Entry(frame, text="(kg)")
        weightEntry.grid(column=2, row=5, sticky=(N))
        weightEntry.insert(END, "(kg)")

        content.grid_columnconfigure(0, weight=1)
        content.grid_columnconfigure(2, weight=1)
        content.grid_columnconfigure(4, weight=1)
        content.grid_rowconfigure(0, weight=2)
        content.grid_rowconfigure(2, weight=2)
        content.grid_rowconfigure(3, weight=2)
        content.grid_rowconfigure(4, weight=2)
        content.grid_rowconfigure(6, weight=2)
コード例 #2
0
    def __init__(self, root, show_login_view, show_create_user_view):
        self._frame = None
        self._plaintext = ttk.StringVar()
        self._ciphertext = ttk.StringVar()
        self._key = ttk.IntVar(master=self._frame)

        self._plain_label = None
        self._plain_entry = None
        self._encrypt_button = None
        self._key_label = None
        self._key_entry = None
        self._cipher_label = None
        self._cipher_entry = None
        self._decrypt_button = None

        self.initialize()
コード例 #3
0
ファイル: themes.py プロジェクト: pedgc/challenge
    def __init__(self):
        # super().__init__()
        pass

        # root window
        window = ThemedTk(theme="arc")
        window.title('Theme Demo')
        window.geometry('400x300')
        window.style = ttk.Style(self)

        # label
        label = ttk.Label(window, text='Name:')
        label.grid(column=0, row=0, padx=10, pady=10, sticky='w')
        # entry
        textbox = ttk.Entry(window)
        textbox.grid(column=1, row=0, padx=10, pady=10, sticky='w')
        # button
        btn = ttk.Button(window, text='Show')
        btn.grid(column=2, row=0, padx=10, pady=10, sticky='w')

        # radio button
        window.selected_theme = ttk.StringVar()
        theme_frame = ttk.LabelFrame(self, text='Themes')
        theme_frame.grid(padx=10, pady=10, ipadx=20, ipady=20, sticky='w')

        for theme_name in window.style.theme_names():
            rb = ttk.Radiobutton(theme_frame,
                                 text=theme_name,
                                 value=theme_name,
                                 variable=window.selected_theme,
                                 command=window.change_theme)
            rb.pack(expand=True, fill='both')