コード例 #1
0
    def MakeWidgets(self):
        self.frame_1 = tk.Frame(master=self.window)
        self.label_1 = tk.Label(master=self.frame_1, text="Have Set ID:")
        self.entry_1 = tk.Entry(master=self.frame_1, width=40)
        self.label_1.grid(row=0, column=0, sticky="w")
        self.entry_1.grid(row=0, column=1, sticky="w")

        self.frame_2 = tk.Frame(master=self.window)
        self.label_2 = tk.Label(master=self.frame_2, text="Have Name:")
        self.entry_2 = tk.Entry(master=self.frame_2, width=40)
        self.label_2.grid(row=0, column=0, sticky="w")
        self.entry_2.grid(row=0, column=1, sticky="w")

        self.frame_3 = tk.Frame(master=self.window)
        self.label_3 = tk.Label(master=self.frame_3, text="Want Set ID:")
        self.entry_3 = tk.Entry(master=self.frame_3, width=40)
        self.label_3.grid(row=0, column=0, sticky="w")
        self.entry_3.grid(row=0, column=1, sticky="w")

        self.frame_4 = tk.Frame(master=self.window)
        self.label_4 = tk.Label(master=self.frame_4, text="Want Name:")
        self.entry_4 = tk.Entry(master=self.frame_4, width=40)
        self.label_4.grid(row=0, column=0, sticky="w")
        self.entry_4.grid(row=0, column=1, sticky="w")

        self.frame_5 = tk.Frame(master=self.window)
        if sys.platform.startswith('darwin'):
            self.button_submit = tkx.Button(master=self.frame_5,
                                            text="Submit",
                                            bg='white',
                                            fg='black',
                                            command=self.SubmitQuery)
            self.button_quit = tkx.Button(master=self.frame_5,
                                          text="Quit",
                                          bg='white', fg='black',
                                          command=self.QuitProg)
        else:
            self.button_submit = tk.Button(master=self.frame_5,
                                           text="Submit",
                                           command=self.SubmitQuery)
            self.button_quit = tk.Button(master=self.frame_5,
                                         text="Quit",
                                         command=self.QuitProg)
        self.button_submit.grid(row=0, column=0, sticky="w")
        self.button_quit.grid(row=0, column=1, sticky="w")

        self.frame_6 = tk.Frame(master=self.window)
        self.text_box = ScrolledText(master=self.frame_6)

        # Lay out the frames using the grid layout manager.
        self.frame_1.grid(row=0, column=0, padx=5, pady=5)
        self.frame_2.grid(row=1, column=0, padx=5, pady=5)
        self.frame_3.grid(row=2, column=0, padx=5, pady=5)
        self.frame_4.grid(row=3, column=0, padx=5, pady=5)
        self.frame_5.grid(row=4, column=0, padx=5, pady=5)
        self.frame_6.grid(row=5, column=0, padx=5, pady=5)

        # Stop window resizing.
        self.window.resizable(False, False)
コード例 #2
0
ファイル: app.py プロジェクト: fossabot/Auto-Background
    def button_layout(self, **kw):
        self.button_containter = tk.LabelFrame(self,
                                               text='Actions',
                                               fg=self.fg,
                                               bg=self.bg,
                                               labelanchor='n',
                                               font=self.heading_font)
        self.button_containter.grid(**kw)
        self.button_containter.rowconfigure(0, weight=1)
        self.button_containter.columnconfigure(0, weight=1)
        self.button_containter.columnconfigure(1, weight=1)

        self.b1 = tkm.Button(self.button_containter,
                             text='Resume',
                             fg=self.fg,
                             bg=self.bg_but,
                             borderless=1,
                             pady=10,
                             font=self.body_font,
                             focuscolor=self.fg,
                             activebackground=(self.bg_but.get(),
                                               self.bg.get()),
                             disabledbackground='#FEFAEC',
                             disabledforeground='grey')
        self.b1['command'] = lambda: self.button_click(self.b1)
        self.b1.grid(row=0, column=0, padx=5, sticky='ew', pady=5)
        self.b2 = tkm.Button(self.button_containter,
                             text='Pause',
                             fg=self.fg,
                             bg=self.bg_but,
                             borderless=1,
                             pady=10,
                             font=self.body_font,
                             focuscolor=self.fg,
                             activebackground=self.bg,
                             disabledbackground='#FEFAEC',
                             disabledforeground='grey')
        self.b2['command'] = lambda: self.button_click(self.b2)
        self.b2.grid(row=0, column=1, padx=(0, 5), sticky='ew', pady=5)
コード例 #3
0
 def create(self, **kwargs):
     self._master = self.root
     if self._ttk_parent and self._ttk_parent_with_style:
         style = ttk.Style(self.root)
         self._ttk_style = "Custom.TFrame"
         style.configure(self._ttk_style, background="pink")
         self._master = ttk.Frame(self.root, style=self._ttk_style)
         self._master.pack()
     elif self._ttk_parent:
         self._master = ttk.Frame(self.root)
         self._master.pack()
     if self._type == 'normal':
         return tkmacosx.Button(self._master, **kwargs)
     if self._type == 'circle':
         return tkmacosx.CircleButton(self._master, **kwargs)
コード例 #4
0
ファイル: test_widgets.py プロジェクト: vic025/tkmacosx
 def create(self, **kwargs):
     kwargs['bg'] = kwargs.get('bg', kwargs.get('background', 'black'))
     kwargs['fg'] = kwargs.get('fg', kwargs.get('foreground', 'white'))
     return tkmacosx.Button(self.root, **kwargs)
コード例 #5
0
ファイル: test.py プロジェクト: dtxwhzw/Python_project
colcut = 10
color = 'green'
root.config(bg='black')
root.geometry('+500+200')
ft = tkFont.Font(family='Fixdsys', size=12, weight=tkFont.BOLD)
Label(root,
      text='Pokemon: Got 2 Fins Them All!',
      fg='white',
      bg='#F08080',
      height=3,
      font=ft).grid(row=0, sticky=W + E, columnspan=10)
for j in range(10):
    for i in range(10):

        e1[j][i] = tkmacosx.Button(height=60,
                                   width=60,
                                   background='#228B22',
                                   command=press(j, i))
        e1[j][i].grid(row=j + 2,
                      column=i,
                      sticky=W + E + N + S,
                      padx=1,
                      pady=1)


        #Label( bg=color).grid(row=j,column=i, sticky=W+E+N+S,padx = 1,pady=1)
        #Label(text=color, bg=color).pack(side = TOP,expand = False,fill =BOTH,padx=1,pady=1)
def press(j, i):
    e1[j][i]['bg'] = 'red'


#e2 = Label(text = 'Hello',fg = 'white',bg = 'red')
コード例 #6
0
    def __init__(self):
        #ROOT
        root = tk.Tk()
        root.title("Monitor de Sensores")
        w, h = 800, 600
        root.geometry('{}x{}'.format(w, h))
        root.config(bg="black")

        #TITLE
        lbl_title = tk.Label(root,
                             text="Monitor de Sensores",
                             font=('Helvatical bold', 40),
                             bg="black",
                             fg="white")
        lbl_title.pack(pady=15)

        #MENU LABEL
        lbl_menu = tk.Label(
            root,
            text="Escolha o nome do sensor que deseja monitorar",
            font=('Helvatical bold', 18),
            bg="black",
            fg="white")
        lbl_menu.pack()
        lbl_info = tk.Label(root,
                            text="Click (+) para adcionar",
                            font=('Helvatical bold', 12),
                            bg="black",
                            fg="white")
        lbl_info.pack()

        #MENU OPTIONS
        OPTIONS = [""]
        self.options = OPTIONS

        #MENU NAMETYPE
        NAMETYPE = {}
        self.nametype = NAMETYPE

        #DROPDOWN MENU OPTIONS
        option_value = tk.StringVar(root)
        self.option_value = option_value
        option_value.set(OPTIONS[0])
        self.selection = OPTIONS[0]

        #ICONS
        img_add = tk.PhotoImage(file="./img/add.gif")
        self.img_all = {
            "Temperatura": tk.PhotoImage(file="./img/temperatura.gif"),
            "Umidade": tk.PhotoImage(file="./img/umidade.gif"),
            "Velocidade": tk.PhotoImage(file="./img/velocidade.gif")
        }

        #SELECTOR MENU
        frm_add_menu = tk.Frame(root, pady=20,
                                bg="black")  # ADD MENU - FRAME START

        lbl_nome = tk.Label(frm_add_menu,
                            text="nome: ",
                            font=('Helvatical bold', 12),
                            bg="black",
                            fg="white")
        lbl_nome.pack(side=tk.LEFT, fill=tk.BOTH)

        opt_sensor_name = tk.OptionMenu(frm_add_menu,
                                        option_value,
                                        *OPTIONS,
                                        command=self.get_option)
        opt_sensor_name.config(bg="black")
        opt_sensor_name.pack(side=tk.LEFT, fill=tk.BOTH)
        self.opt_sensor_name = opt_sensor_name

        btn_add_sensor = tkm.Button(frm_add_menu,
                                    image=img_add,
                                    bg="black",
                                    fg="black",
                                    command=self.create_monitor,
                                    highlightthickness=0,
                                    bd=0)

        btn_add_sensor.pack(side=tk.LEFT)
        self.btn_add_sensor = btn_add_sensor

        frm_add_menu.pack()  # ADD MENU - FRAME END

        frm_sensors = tk.Frame(root, bg="black")  # SENSORS - FRAME START
        frm_sensors.pack()
        self.frm_sensors = frm_sensors  # SENSORS - FRAME END

        self.root = root
コード例 #7
0
    def __init__(self,
                 cfg: str = "cfg.yml"):
        # Parse yaml file
        with open(cfg, "r") as yaml_file:
            self.__yaml = yaml.load(yaml_file, Loader=yaml.FullLoader)

        # Check for the output path
        if (self.__yaml["output_path"] is not None) and \
                (not os.path.exists(self.__yaml["output_path"])):
            os.makedirs(self.__yaml["output_path"])
        elif (self.__yaml["output_path"] is not None) and \
                not os.path.isdir(self.__yaml["output_path"]):
            LOGGER.error("Provided output path is already exist and not a directory. "
                         "Please check for the input file.")
            sys.exit(1)

        # Image to show, init to None
        self.__frame = None

        # Initialize the root window and image panel
        self.root = tk.Tk()
        self.__panel = None

        # Set the minimum size of the Tkinter window
        self.root.minsize(850, 500)

        # Open the detection Path
        self.__detect = Detection(google_kit_json_path=self.__yaml["google-kit-json"],
                                  categories=self.__yaml["categories"],
                                  size=(self.__yaml["width"], self.__yaml["height"]),
                                  max_results=int(self.__yaml["max_request"]),
                                  camera=self.__yaml["camera"],
                                  )

        # Check OS to make the design
        if platform.system() == "Darwin":
            # Design the button of "snapshot" for MACOSX
            self.__snap_btn = tkmacosx.Button(self.root,
                                              text="Snapshot!",
                                              command=self.__take_snapshot,
                                              padx=10,
                                              pady=10,
                                              bg="#A8E0FF")
            # Design the button of "quit" for MACOSX
            self.__quit_btn = tkmacosx.Button(self.root,
                                              text='Quit',
                                              command=self.__on_close,
                                              padx=10,
                                              pady=10,
                                              background="#778EBB")
        else:
            # Design the button of "snapshot" for other OS
            self.__snap_btn = tk.Button(self.root,
                                        text="Snapshot!",
                                        command=self.__take_snapshot,
                                        padx=10,
                                        pady=10,
                                        bg="#A8E0FF")
            # Design the button of "quit" for other OS
            self.__quit_btn = tk.Button(self.root,
                                        text='Quit',
                                        command=self.__on_close,
                                        padx=10,
                                        pady=10,
                                        background="#778EBB")

        self.__snap_btn.grid(row=0,
                             column=1)

        self.__quit_btn.grid(row=3,
                             column=1)

        # Design the label to display which categories show up on the screen
        self.__info_label = tk.Label(bg="#8EE3F5",
                                     height=20,
                                     width=16,
                                     anchor="nw",
                                     padx=10,
                                     pady=10)
        self.__info_label.grid(row=1,
                               column=1)

        # Add user-defined label
        self.__user_define_label = tk.Label(bg="#70CAD1",
                                            height=10,
                                            width=16,
                                            anchor="nw",
                                            padx=10,
                                            pady=10)

        # Quit the event and start the video loop
        self.__quit = threading.Event()
        video_start = threading.Thread(target=self.__video_loop,
                                       daemon=True)
        video_start.start()

        # Set a callback to handle when the window is closed
        self.root.wm_title("Object detection")
        self.root.wm_protocol("WM_DELETE_WINDOW", self.__on_close)
コード例 #8
0
                      shell=True)
                root.destroy()
            except:
                Popen('python main.py',
                      cwd='/Users/{}/Desktop/project_pios'.format(getuser()),
                      shell=True)
                root.destroy()
        else:
            root.destroy()
    except:
        showerror(message='下载失败\n\nInstall failed')
        hint['text'] = '下载Project-Pios / Project-Pios Installer'


hint = Label(root,
             text='下载Project-Pios / Project-Pios Installer',
             font=("Arial", 15))
hint.place(relx=0.5, rely=0.2, anchor=CENTER)

start = tkmacosx.Button(root,
                        text='开始/Start',
                        borderless=1,
                        bg='black',
                        fg='white',
                        activebackground='white',
                        activeforeground='black',
                        command=installs)
start.place(relx=0.5, rely=0.6, anchor=CENTER)

root.mainloop()
コード例 #9
0
ファイル: test1.py プロジェクト: dtxwhzw/Python_project
B = np.array([
    0,
    0,
    0,
    0,
    0,
    0,
] * 6)
C = [[0] * 10 for i in range(10)]


def color(i):
    A = [i]
    for t in A:
        B[t] = (B[t] + 1) % 2
        bts[t]['bg'] = colors[B[t]]
        bts[t]['text'] = 'YES!'


n = 36
a = 0
bts = []
for i in range(n):
    button1 = tk.Button(root, text=i, command=lambda j=i: color(j))

    bts.append(button1)
for i in range(n):
    bts[i].grid(row=int((i / 6) % 6), column=i % 6)

root.mainloop()
コード例 #10
0
    def __init__(self, root):
        root.geometry('850x600')
        root.title('MeasureApp')
        root.config(bg='#393e46')

        self.Framebg = tk.Frame(root)
        self.Framebg.config(bg='#393e46')

        self.mainFont = Font(family='Andale Mono Normal', size=50)

        self.logoImg = tk.PhotoImage(
            file='/Users/ianjijon/Desktop/MeasureApp/ImgFiles/Logo1.png')

        self.MenuFrame = tk.Frame(root, width=200, height=600)
        self.MenuFrame.config(background='#24272D')
        self.MenuFrame.place(x=0, y=0)

        self.LabelLogo = tk.Label(image=self.logoImg, bg='#24272D')
        self.LabelLogo.place(x=30, y=20)

        self.MainFrame = tkm.SFrame(root,
                                    width='648',
                                    height='700',
                                    bg='#393e46')
        self.MainFrame.place(x=200, y=80)

        self.ButtonHome = tkm.Button(self.MenuFrame,
                                     text='Home',
                                     bg='gray',
                                     fg='white')
        self.ButtonHome.place(x=50, y=200)

        self.ButtonObjectives = tkm.Button(self.MenuFrame,
                                           text='Objectives',
                                           bg='gray',
                                           fg='white')
        self.ButtonObjectives.place(x=50, y=250)

        self.ButtonStudyRutine = tkm.Button(self.MenuFrame,
                                            text='Study Routine',
                                            bg='gray',
                                            fg='white')
        self.ButtonStudyRutine.place(x=40, y=300)

        self.ButtonProjects = tkm.Button(self.MenuFrame,
                                         text='Projects',
                                         bg='gray',
                                         fg='white')
        self.ButtonProjects.place(x=50, y=350)

        self.ButtonShare = tkm.Button(self.MenuFrame,
                                      text='Share',
                                      bg='gray',
                                      fg='white')
        self.ButtonShare.place(x=50, y=400)

        self.ButtonExit = tkm.Button(self.MenuFrame,
                                     text='Exit',
                                     bg='gray',
                                     fg='white',
                                     command=root.destroy)
        self.ButtonExit.place(x=50, y=450)

        self.TitleLabel = tk.Label(root,
                                   text='MeausereApp',
                                   font=self.mainFont,
                                   bg='#393e46',
                                   fg='white')
        self.TitleLabel.place(x=360, y=0)
コード例 #11
0
 def create(self, **kwargs):
     return tkmacosx.Button(self.root, **kwargs)