Exemple #1
0
 def make_file_type_menu(self, menubar):
     _, e = os.path.splitext(self.file)
     ext = e[1:]
     if ext == "py":
         pybtn = Menubutton(menubar, text='Python', name=ext)
         pybtn.pack(side=LEFT)
         py = Menu(pybtn, tearoff=0)
         py.add_command(label='Compile',
                        command=self.compile_python,
                        accelerator="Ctrl+F5")
         py.add_command(label='Run',
                        command=self.run_python,
                        accelerator="F5")
         pybtn.config(menu=py)
         self.bind_all("<Control-F5>", self.compile_python)
         self.bind_all("<F5>", self.run_python)
     elif ext == "tcl":
         tclbtn = Menubutton(menubar, text='TCL', name=ext)
         tclbtn.pack(side=LEFT)
         tcl = Menu(tclbtn, tearoff=0)
         tcl.add_command(label='Run',
                         command=self.run_tcl,
                         accelerator="F5")
         tclbtn.config(menu=tcl)
         self.bind_all("<F5>", self.run_tcl)
Exemple #2
0
def makemenu(parent):
    '''
    Builds the menu
    :param parent: the parent component
    '''
    menubar = Frame(parent)  # relief=RAISED, bd=2...
    menubar.pack(side=TOP, fill=X)

    fbutton = Menubutton(menubar, text='File', underline=0)
    fbutton.pack(side=LEFT)

    file = Menu(fbutton)
    file.add_command(label='New...', command=notdone, underline=0)
    file.add_command(label='Open...', command=notdone, underline=0)
    file.add_command(label='Quit', command=parent.quit, underline=0)
    fbutton.config(menu=file)

    ebutton = Menubutton(menubar, text='Edit', underline=0)
    ebutton.pack(side=LEFT)

    edit = Menu(ebutton, tearoff=False)
    edit.add_command(label='Cut', command=notdone, underline=0)
    edit.add_command(label='Paste', command=notdone, underline=0)
    edit.add_separator()
    ebutton.config(menu=edit)

    submenu = Menu(edit, tearoff=True)
    submenu.add_command(label='Spam', command=parent.quit, underline=0)
    submenu.add_command(label='Eggs', command=notdone, underline=0)
    edit.add_cascade(label='Stuff', menu=submenu, underline=0)
    return menubar
Exemple #3
0
    def __init__(self):
        master = Tk()
        master.title('Text Editor', )
        master.geometry('750x500')
        master.resizable(0, 0)

        back = tk.Frame(master=master, bg='gray')
        back.pack_propagate(0)
        back.pack(fill='both', expand = True)

        txt_box = Text(master=back, bg='pale green', fg='black', font=('Helvetica', '12'))
        txt_box.place(height='480', width='750', x='0', y='30')

        file_name = Text(master=back, bg='white')
        file_name.place(x='110', y='5', height='20', width='150')

        file_btn = Menubutton(master=back, bg='gray', text='File')
        file_btn.menu = Menu(file_btn)
        file_btn['menu'] = file_btn.menu
        file_btn.menu.add_command(label='Open', command=lambda: open_file(file_name, txt_box))
        file_btn.place(x='0', y='0', height='30', width='50')

        save_btn = Menubutton(master=back, bg='gray', text='Save')
        save_btn.menu = Menu(save_btn)
        save_btn['menu'] = save_btn.menu
        save_btn.menu.add_command(label='Save', command=lambda: save_file(file_name, txt_box))
        save_btn.place(x='50.5', y='0', height='30', width='50')



        master.mainloop()
 def __init__(self, parent: Widget, chart_manager, color):
     QuoteKindSelector.__init__(self, parent, chart_manager, color)
     self.quote_kind_var = StringVar()
     self.menubutton = Menubutton(
         self,
         textvariable=self.quote_kind_var,
         font=Fonts.FIXED_14,
         width=4,
         background=color,
         foreground=color.contrast,
         bd=0,
         pady=6,
     )
     self.menu = Menu(
         self.menubutton,
         background=color,
         foreground=color.contrast,
         font=Fonts.FIXED_14,
         tearoff=False,
     )
     self.menubutton["menu"] = self.menu
     self.menu.add_command(
         label=QuoteKind.ASK.name,
         command=partial(self.quote_kind_callback, QuoteKind.ASK),
     )
     self.menu.add_command(
         label=QuoteKind.MID.name,
         command=partial(self.quote_kind_callback, QuoteKind.MID),
     )
     self.menu.add_command(
         label=QuoteKind.BID.name,
         command=partial(self.quote_kind_callback, QuoteKind.BID),
     )
     grid(self.menubutton, 0, 0)
Exemple #5
0
 def __init__(self, parent: Widget, chart_manager, color):
     GranSelector.__init__(self, parent, chart_manager, color)
     self.gran_var = StringVar()
     self.menubutton = Menubutton(
         self,
         textvariable=self.gran_var,
         font=Fonts.FIXED_14,
         width=10,
         background=color,
         foreground=color.contrast,
         bd=0,
         pady=6,
     )
     self.menu = Menu(
         self.menubutton,
         background=color,
         foreground=color.contrast,
         font=Fonts.FIXED_14,
         tearoff=False,
     )
     self.menubutton["menu"] = self.menu
     for item in self.MENU_LAYOUT:
         if item is None:
             self.menu.add_separator()
         else:
             self.menu.add_command(
                 label=item.name, command=partial(self.gran_callback, item)
             )
     grid(self.menubutton, 0, 0)
Exemple #6
0
    def task_list(self):
        fr = Frame(self)
        fr_top = Frame(fr)
        task_lbx = Listbox(fr_top)
        task_lbx.pack(anchor="center",
                      fill="both",
                      expand=True,
                      padx=3,
                      pady=3)
        self._task_box = task_lbx

        fr_bot = Frame(fr, height='2')
        b1 = Menubutton(fr_bot, text='실행메뉴')
        b1.menu = Menu(b1, tearoff=0)
        b1['menu'] = b1.menu
        b1.menu.add_command(label='실행', command=self.convert)
        b1.menu.add_command(label='비우기', command=self.delete_task_item)
        b1.pack()

        fr_top.pack(side='top', fill='both', expand=True)
        fr_bot.pack(side='bottom', fill='x')
        task_lbx.config(highlightcolor='green',
                        font=('굴림체', 10),
                        activestyle='none',
                        selectmode='extended')

        self.task_lbx = task_lbx

        return fr
Exemple #7
0
 def __init__(self, parent: Widget, chart_manager, color):
     PairSelector.__init__(self, parent, chart_manager, color)
     self.pair_var = StringVar()
     self.menubutton = Menubutton(
         self,
         textvariable=self.pair_var,
         font=Fonts.FIXED_14,
         width=7,
         background=color,
         foreground=color.contrast,
         bd=0,
         pady=6,
     )
     self.menu = Menu(
         self.menubutton,
         background=color,
         foreground=color.contrast,
         font=Fonts.FIXED_14,
         tearoff=False,
     )
     self.menubutton["menu"] = self.menu
     for pair in Pair.iter_pairs():
         self.menu.add_command(label=pair.camel(),
                               command=partial(self.pair_callback, pair))
         if pair in self.SEPARATOR_AFTER:
             self.menu.add_separator()
     grid(self.menubutton, 0, 0)
Exemple #8
0
 def toc_menu(self, text):
     "Create table of contents as drop-down menu."
     toc = Menubutton(self, text='TOC')
     drop = Menu(toc, tearoff=False)
     for lbl, dex in text.parser.toc:
         drop.add_command(label=lbl, command=lambda dex=dex:text.yview(dex))
     toc['menu'] = drop
     return toc
Exemple #9
0
def ventanaPrincipal():
    root=Tk()
    w= Frame(root)
    w.pack()
    
    bottomframe= Frame(root)
    bottomframe.pack(side=BOTTOM)
    
    mb1=Menubutton(bottomframe, text="Datos", relief=RAISED )
    mb1.menu =Menu(mb1, tearoff = 0 )
    mb1["menu"]=mb1.menu

    mb1.menu.add_command(label="Almacenar",command=fe.almacenarBD)
    mb1.menu.add_command(label="Listar",command=fp.list_bd)
    mb1.menu.add_command(label="Salir",command=root.destroy)

    mb1.grid(row=0,column=0)
    
    mb1=Menubutton(bottomframe, text="Buscar", relief=RAISED )
    mb1.menu =Menu(mb1, tearoff = 0 )
    mb1["menu"]=mb1.menu

    mb1.menu.add_command(label="Tema",command=fp.buscar_BD_Titulo)
    mb1.menu.add_command(label="Autor",command=fp.buscar_BD_Autor)
    mb1.menu.add_command(label="Fecha",command=fp.buscar_BD_Fecha)
   

    mb1.grid(row=0,column=1)
    
    
    mb1=Menubutton(bottomframe, text="Estadisticas", relief=RAISED )
    mb1.menu =Menu(mb1, tearoff = 0 )
    mb1["menu"]=mb1.menu

    mb1.menu.add_command(label="Temas mas populares",command=fp.popularesBD)
    mb1.menu.add_command(label="Temas mas activos",command=fp.activosBD)
   

    mb1.grid(row=0,column=2)
    
    #DESC
    
    root.mainloop()
Exemple #10
0
 def menuHelp(self):
     "Set menu with help information"
     hbutton = Menubutton(self.bar, text='Help', underline=0)
     hbutton.grid(row=0, column=2, sticky='w')
     menu = Menu(hbutton, tearoff=0)
     menu.add_command(label='Keys (F1)',
                      command=lambda: msg.showinfo("Keys", KEYS))
     menu.add_command(label='About',
                      command=lambda: msg.showinfo("About", ABOUT))
     hbutton.configure(menu=menu)
Exemple #11
0
    def create_pull_down_menu(self):
        mb = Menubutton(self.master, text='Select API.', relief=RAISED)
        mb.grid()
        mb.menu = Menu(mb, tearoff=0)
        mb['menu'] = mb.menu
        var1 = IntVar()
        var2 = IntVar()
        var3 = IntVar()

        mb.menu.add_checkbutton(label="")
        return
Exemple #12
0
    def make_menu(self):
        self.menubar = Frame(self)
        self.menubar.pack(side=TOP)

        filebtn = Menubutton(self.menubar, text='File')
        filebtn.pack(side=LEFT)
        file = Menu(filebtn, tearoff=0)
        file.add_command(label='New', command=self.new, accelerator="Ctrl+N")
        file.add_command(label='Save', command=self.save, accelerator="Ctrl+S")
        file.add_command(label='Quit', command=self.quit, accelerator="Ctrl+Q")
        filebtn.config(menu=file)

        editbtn = Menubutton(self.menubar, text='Edit')
        editbtn.pack(side=LEFT)
        edit = Menu(editbtn, tearoff=0)
        edit.add_command(label='Cut', command=self.cut)
        edit.add_command(label='Copy', command=self.copy)
        edit.add_command(label='Paste', command=self.paste)
        editbtn.config(menu=edit)

        if self.file:
            self.make_file_type_menu(self.menubar)
Exemple #13
0
 def menuTag(self):
     "Set menu for working with tags"
     fbutton = Menubutton(self.bar, text='Tags', underline=0)
     fbutton.grid(row=0, column=1, sticky='w')
     menu = Menu(fbutton, tearoff=0)
     menu.add_command(label='Search... (/)',
                      command=lambda: self.openSearch(1))
     menu.add_command(label='Edit ([)',
                      command=lambda: self.panel[self.src].tagEdit(1))
     menu.add_command(label="Don't save (Esc)",
                      command=lambda: self.panel[self.src].tagExit(1))
     menu.add_command(label='Correct DB',
                      command=lambda: self.fo.correctDb())
     fbutton.configure(menu=menu)
 def __init__(self, topwin, itemkeyval):
     self.parentframe = topwin
     self.mb = Menubutton(topwin, text="CheckComboBox", relief=RAISED)
     self.mb.grid()
     self.mb.menu = Menu(self.mb, tearoff=0)
     self.mb["menu"] = self.mb.menu
     #
     #self.mb.menu["menu"] = self.mb.menu
     self.itemischecked = {}
     self.comboitemcount = 0
     for menuentry in itemkeyval:
         itemvar = IntVar()
         itemvar.set(itemkeyval[menuentry])
         # a keyvalue pair with menu item name and an itemvar unique to that selection
         self.itemischecked[menuentry] = itemvar
         self.mb.menu.add_checkbutton(label=menuentry, variable=itemvar)
         self.comboitemcount += 1
Exemple #15
0
 def menuFile(self):
     "Set menu for file commands"
     cbutton = Menubutton(self.bar, text='Files', underline=0)
     cbutton.grid(row=0, column=0, sticky='w')
     menu = Menu(cbutton, tearoff=0)
     menu.add_command(label='Rename (F2)',
                      command=lambda: self.panel[self.src].rename(1))
     menu.add_command(label='Copy (F5)', command=lambda: self.copy(1))
     menu.add_command(label='Move (F6)', command=lambda: self.move(1))
     menu.add_command(label='New folder (F7)',
                      command=lambda: self.panel[self.src].newDir(1))
     menu.add_command(label='Equal panels (=)',
                      command=lambda: self.makeEqual(1))
     menu.add_separator({})
     menu.add_command(label='Quit (Ctrl+Q)',
                      command=lambda: self.root.destroy())
     cbutton.configure(menu=menu)
Exemple #16
0
    def inicializar_gui(self):
        lbl_titulo = Label(self.master, text='Lenguajes programación', font='31')
        lbl_titulo.pack()

        mbn_lenguajes = Menubutton(self.master, text='Menú lenguajes')

        mbn_lenguajes.menu = Menu(mbn_lenguajes)
        mbn_lenguajes['menu'] = mbn_lenguajes.menu

        var_javascript = IntVar()
        var_python = IntVar()
        var_java = IntVar()

        mbn_lenguajes.menu.add_command(label = 'JavaScript', command=self.mostrar_mensaje)
        mbn_lenguajes.menu.add_command(label = 'Python', command=self.mostrar_mensaje)
        mbn_lenguajes.menu.add_command(label = 'Java', command=self.mostrar_mensaje)

        mbn_lenguajes.pack()
Exemple #17
0
    def _make_menu_bar(self):
        """
        make menu bar at the top (TK9.0 menus below)
        expand=no, fill=X so same width on resize
        """
        menu_bar = Frame(self, relief=RAISED, bd=2)
        menu_bar.pack(side=TOP, fill=X)

        for (name, key, items) in self.menu_bar:
            mbutton = Menubutton(menu_bar, text=name, underline=key)
            mbutton.pack(side=LEFT)
            pulldown = Menu(mbutton)
            self._add_menu_items(pulldown, items)
            mbutton.config(menu=pulldown)

        if self.help_button:
            Button(menu_bar,
                   text='Help',
                   cursor='gumby',
                   relief=FLAT,
                   command=self.help).pack(side=RIGHT)
Exemple #18
0
    def component_list(self):
        #sandy brown
        fr1 = Frame(self)
        scrollbar = Scrollbar(fr1)
        scrollbar.pack(side="right", fill="y")

        self._list = Listbox(fr1,
                             bg="dim grey",
                             fg="white",
                             width=20,
                             yscrollcommand=scrollbar.set)

        mb1 = Menubutton(fr1, text='선택메뉴', relief='flat', bg='steel blue3')
        mb1.menu = Menu(mb1, tearoff=0)
        mb1['menu'] = mb1.menu
        mb1.menu.add_command(label='등록', command=self.choose_all)
        mb1.pack(side='bottom')
        mb1.menu.add_command(label='선택',
                             command=lambda: self._list.select_set(0, END))
        mb1.menu.add_command(
            label='해제', command=lambda: self._list.selection_clear(0, 'end'))

        self._list.pack(anchor="center",
                        fill="both",
                        expand=True,
                        padx=3,
                        pady=3)

        scrollbar.config(command=self._list.yview)
        self._list.config(highlightcolor='green',
                          font=('나눔고딕', 10),
                          activestyle='none',
                          selectmode='extended')

        self._list.bind('<<ListboxSelect>>', self.select_item)
        self._list.bind('<Button-3>', self.sub_menu1)
        self._list.exportselection = 0

        return fr1
Exemple #19
0
    def gui_main():
        funktsioonid=[]
        fun_label = '---Kasutuses---'
        def fun1():
            funktsioonid.append("f1")
            menüü.menu.entryconfig(1, label=fun_label)
            menüü2.menu.entryconfig(1, label=fun_label)
            menüü3.menu.entryconfig(1, label=fun_label)
            return funktsioonid
        def fun2():
            funktsioonid.append("f2")
            menüü.menu.entryconfig(2, label=fun_label)
            menüü2.menu.entryconfig(2, label=fun_label)
            menüü3.menu.entryconfig(2, label=fun_label)
            return funktsioonid
        def fun3():
            funktsioonid.append("f3")
            menüü.menu.entryconfig(3, label=fun_label)
            menüü2.menu.entryconfig(3, label=fun_label)
            menüü3.menu.entryconfig(3, label=fun_label)
        def fun4():
            funktsioonid.append("f4")
            menüü.menu.entryconfig(4, label=fun_label)
            menüü2.menu.entryconfig(4, label=fun_label)
            menüü3.menu.entryconfig(4, label=fun_label)
        def fun5():
            funktsioonid.append("f5")
            menüü.menu.entryconfig(5, label=fun_label)
            menüü2.menu.entryconfig(5, label=fun_label)
            menüü3.menu.entryconfig(5, label=fun_label)
            
        def menüülist(menüü):
            menüü.menu.add_command(label="Paneb heleduse maksimumile",command=fun1, activebackground="gray30", activeforeground="snow2")
            menüü.menu.add_command(label="Paneb heleduse miinimumile",command=fun2, activebackground="gray30", activeforeground="snow2")
        ##    menüü.menu.add_command(label="Funktsioon 3",command=fun3, activebackground="gray30", activeforeground="snow2")
        ##    menüü.menu.add_command(label="Funktsioon 4",command=fun4, activebackground="gray30", activeforeground="snow2")
        ##    menüü.menu.add_command(label="Funktsioon 5",command=fun5, activebackground="gray30", activeforeground="snow2")

        raam = Tk()
        raam.title("Kasutajaliides")

        pealkiri=ttk.Label(raam, text="Palun vali igale liigutusele vastav funktsioon (esimene valik loeb): ")
        pealkiri.grid(column=1, row=0, padx=10, pady=10, sticky=(N,S,W,E))

        silt1 = ttk.Label(raam, text="Üks sõrm püsti")
        silt1.grid(column=1, row=1, padx=10, pady=10, sticky=(E))
        silt2 = ttk.Label(raam, text="Kaks sõrme püsti")
        silt2.grid(column=1, row=2, padx=10, pady=10, sticky=(E))
        #silt3 = ttk.Label(raam, text="Kolm sõrme püsti")
        #silt3.grid(column=1, row=3, padx=10, pady=10, sticky=(E))

        menüü=Menubutton(raam, text="Vali funktsioon", textvariable="Funktsioon 1", bg="gray60", activebackground="gray30", activeforeground="snow2")
        menüü.menu = Menu(menüü)  
        menüü["menu"]=menüü.menu
        menüülist(menüü)

        menüü2=Menubutton(raam, text="Vali funktsioon", bg="gray60", activebackground="gray30", activeforeground="snow2")
        menüü2.menu = Menu(menüü2)  
        menüü2["menu"]=menüü2.menu
        menüülist(menüü2) 

        menüü3=Menubutton(raam, text="Vali funktsioon", bg="gray60", activebackground="gray30", activeforeground="snow2")
        menüü3.menu = Menu(menüü3)  
        menüü3["menu"]=menüü3.menu
        menüülist(menüü3)

        menüü.grid(column=2, row=1, padx=10, pady=10, sticky=(W))
        menüü2.grid(column=2, row=2, padx=10, pady=10, sticky=(W))
        #menüü3.grid(column=2, row=3, padx=10, pady=10, sticky=(W))

        def suleaken():
            
            raam.destroy()




        lõpeta=ttk.Button(raam, text="Salvesta", command=suleaken)
        lõpeta.grid(column=2, row=4, padx=10, pady=10, sticky=(N,S,W,E))

        raam.columnconfigure(2,weight=1)
        raam.rowconfigure(2,weight=1)

        raam.mainloop()
        return funktsioonid
Exemple #20
0
#Buttons
word_space = Text(root)
word_space.grid(
    row=1,
    columnspan=2,
    padx=2,
    pady=0,
)

inc = Label(root, text="Welcome to Slate")
inc.grid(row=0, column=0)

save_button = Button(root, text="Save", command=save_as)
save_button.grid(row=0, column=3)

font = Menubutton(root, text="Font")
font.grid(row=0, column=2)

# learn the modern way to execute dropdown menus
font.menu = Menu(font, tearoff=0)

font["menu"] = font.menu

Helvetica = IntVar()
arial = IntVar()
times = IntVar()
Courier = IntVar()
font.menu.add_checkbutton(label="Courier",
                          variable=Courier,
                          command=Font_Courier)
font.menu.add_checkbutton(label="Helvetica",
Exemple #21
0
    def run(self):
        self.realRoot = Tk()
        self.realRoot.attributes('-alpha', 0.75)
        self.realRoot.title('TRPGHelper')

        self.realRoot.protocol("WM_DELETE_WINDOW", lambda: os._exit(0))

        width = 260
        height = 400
        img = ImageTk.PhotoImage(
            Image.open('img/bg.png').resize((width, height)))
        l = Label(self.realRoot, image=img)
        l.grid(row=0, column=0)

        self.root = Frame(self.realRoot)
        self.root.grid(row=0, column=0)

        self.loadImg()
        self.entryFrame = Frame(self.root, height=50, width=120)
        self.rootFrame = Frame(self.root, height=100, width=120)

        self.entryFrame.grid(column=0)
        self.rootFrame.grid(row=2, column=0, sticky=W)

        ButtonRoomName = Button(self.entryFrame, height=1, text='房间')
        ButtonUserName = Button(self.entryFrame, height=1, text='用户')
        EntryRoomName = Entry(self.entryFrame, width=10)
        EntryUserName = Entry(self.entryFrame, width=10)

        MenuButtonState = Menubutton(self.entryFrame, text='选择状态', width=10)
        ms = Menu(MenuButtonState, tearoff=False)
        ms.add_command(label='我在线哦',
                       command=lambda: self.change_state(['-1', '3']))
        ms.add_command(label='真的很忙',
                       command=lambda: self.change_state(['-1', '4']))
        ms.add_command(label='等等我!',
                       command=lambda: self.change_state(['-1', '5']))
        ms.add_command(label='搞快点!',
                       command=lambda: self.change_state(['-1', '6']))
        ms.add_command(label='令人困惑',
                       command=lambda: self.change_state(['-1', '7']))
        ms.add_command(label='瓦特法?',
                       command=lambda: self.change_state(['-1', '8']))
        ms.add_command(label='懂了悟了',
                       command=lambda: self.change_state(['-1', '9']))
        MenuButtonState.configure(menu=ms)

        def _call_roomNameButton(roomName):
            self.data_role['roomName'] = roomName

        def _call_userNameButton_right():
            myHttpRequest(url_delUser,
                          {'userName': self.data_role['userName']})

        def _call_userNameButton_left(userName):
            if (userName != self.data_role['userName']):
                self.change_state(['1', '4'])
            self.data_role['userName'] = userName
            try:
                if (self.data_role['userName'] != '\0'):
                    myHttpRequest(url_register,
                                  {'userName': self.data_role['userName']})
                    myHttpRequest(
                        url_createRoom, {
                            'userName': self.data_role['userName'],
                            'roomName': self.data_role['roomName']
                        })
                    self.rebuild()
            except:
                print('userNameButton error')

        ButtonRoomName.bind(
            "<Button-1>", lambda f: _call_roomNameButton(EntryRoomName.get()))
        ButtonUserName.bind(
            "<Button-1>",
            lambda f: _call_userNameButton_left(EntryUserName.get()))
        ButtonUserName.bind("<Button-3>",
                            lambda f: _call_userNameButton_right())

        ButtonRoomName.grid(column=0, row=0, ipady=2, pady=5, ipadx=2, padx=5)
        ButtonUserName.grid(column=0, row=1, ipady=2, pady=5, ipadx=2, padx=5)
        EntryRoomName.grid(column=1, row=0, pady=5, ipadx=2, padx=5)
        EntryUserName.grid(column=1, row=1, pady=5, ipadx=2, padx=5)
        MenuButtonState.grid(column=2, row=0, pady=5, ipadx=2, padx=5)

        self.root.after(1000, self.update)
        self.root.mainloop()
Exemple #22
0
root = Tk()
root.title("My Text Editor")
root.resizable(False, False)

# The editor
text = Text(root)
text.grid()

# save button
button = Button(root, text="Save", command=save_as)
button.grid()

# hardcoded font button

fontSelection = Menubutton(root, text="Font", relief=RAISED)
fontMenu = Menu(fontSelection, tearoff=0)
helvetica = IntVar('Helvetica')
courier = IntVar('Courier')
fontMenu.add_checkbutton(label="Helvetica",
                         variable=helvetica,
                         command=font_helvetica)
fontMenu.add_checkbutton(label="Courier",
                         variable=courier,
                         command=font_courier)

fontSelection["menu"] = fontMenu
fontSelection.grid()

root.mainloop()
Exemple #23
0
    def createInterface(self):
        # Handle to the toplevels interior
        interior = self.interior()
        menuBar = self.menuBar
        self.menuBar.destroy()

        # Create a frame to hold all stuff
        mainFrame = Frame(interior)

        self.listZone = Pmw.Group(mainFrame, tag_pyclass=None)
        self.listZone.pack(expand=0, fill=tkinter.X, padx=3, pady=3)
        listFrame = self.listZone.interior()

        self.lightEntry = self.createcomponent(
            'Lights List', (),
            None,
            Pmw.ComboBox, (listFrame, ),
            label_text='Light :',
            labelpos=tkinter.W,
            entry_width=25,
            selectioncommand=self.selectLight,
            scrolledlist_items=self.lightList)
        self.lightEntry.pack(side=tkinter.LEFT)

        self.renameButton = self.createcomponent('Rename Light', (),
                                                 None,
                                                 Button, (listFrame, ),
                                                 text=' Rename ',
                                                 command=self.renameLight)
        self.renameButton.pack(side=tkinter.LEFT)

        self.addLighZone = Pmw.Group(listFrame, tag_pyclass=None)
        self.addLighZone.pack(side=tkinter.LEFT)
        insideFrame = self.addLighZone.interior()
        self.lightsButton = Menubutton(insideFrame,
                                       text='Add light',
                                       borderwidth=3,
                                       activebackground='#909090')
        lightsMenu = Menu(self.lightsButton)
        lightsMenu.add_command(label='Add Ambient Light',
                               command=self.addAmbient)
        lightsMenu.add_command(label='Add Directional Light',
                               command=self.addDirectional)
        lightsMenu.add_command(label='Add Point Light', command=self.addPoint)
        lightsMenu.add_command(label='Add Spotlight', command=self.addSpot)

        self.lightsButton.pack(expand=0)
        self.lightsButton['menu'] = lightsMenu

        self.deleteButton = self.createcomponent('delete Light', (),
                                                 None,
                                                 Button, (listFrame, ),
                                                 text='  Delete  ',
                                                 command=self.deleteLight)
        self.deleteButton.pack(side=tkinter.LEFT)

        self.lightColor = seColorEntry(mainFrame,
                                       text='Light Color',
                                       value=self.lightColor)
        self.lightColor['command'] = self.setLightingColorVec
        self.lightColor['resetValue'] = [0.3 * 255, 0.3 * 255, 0.3 * 255, 0]
        self.lightColor.pack(fill=tkinter.X, expand=0)
        self.bind(self.lightColor, 'Set light color')

        # Notebook pages for light specific controls
        self.lightNotebook = Pmw.NoteBook(mainFrame,
                                          tabpos=None,
                                          borderwidth=0)
        ambientPage = self.lightNotebook.add('Ambient')
        directionalPage = self.lightNotebook.add('Directional')
        pointPage = self.lightNotebook.add('Point')
        spotPage = self.lightNotebook.add('Spot')
        # Put this here so it isn't called right away
        self.lightNotebook['raisecommand'] = self.updateLightInfo

        # Directional light controls
        self.dSpecularColor = seColorEntry(directionalPage,
                                           text='Specular Color')
        self.dSpecularColor['command'] = self.setSpecularColor
        self.dSpecularColor.pack(fill=tkinter.X, expand=0)
        self.bind(self.dSpecularColor, 'Set directional light specular color')
        self.dPosition = Vector3Entry(directionalPage, text='Position')
        self.dPosition['command'] = self.setPosition
        self.dPosition['resetValue'] = [0, 0, 0, 0]
        self.dPosition.pack(fill=tkinter.X, expand=0)
        self.bind(self.dPosition, 'Set directional light position')
        self.dOrientation = Vector3Entry(directionalPage, text='Orientation')
        self.dOrientation['command'] = self.setOrientation
        self.dOrientation['resetValue'] = [0, 0, 0, 0]
        self.dOrientation.pack(fill=tkinter.X, expand=0)
        self.bind(self.dOrientation, 'Set directional light orientation')

        # Point light controls
        self.pSpecularColor = seColorEntry(pointPage, text='Specular Color')
        self.pSpecularColor['command'] = self.setSpecularColor
        self.pSpecularColor.pack(fill=tkinter.X, expand=0)
        self.bind(self.pSpecularColor, 'Set point light specular color')

        self.pPosition = Vector3Entry(pointPage, text='Position')
        self.pPosition['command'] = self.setPosition
        self.pPosition['resetValue'] = [0, 0, 0, 0]
        self.pPosition.pack(fill=tkinter.X, expand=0)
        self.bind(self.pPosition, 'Set point light position')

        self.pConstantAttenuation = Slider(pointPage,
                                           text='Constant Attenuation',
                                           max=1.0,
                                           resolution=0.01,
                                           value=1.0)
        self.pConstantAttenuation['command'] = self.setConstantAttenuation
        self.pConstantAttenuation.pack(fill=tkinter.X, expand=0)
        self.bind(self.pConstantAttenuation,
                  'Set point light constant attenuation')

        self.pLinearAttenuation = Slider(pointPage,
                                         text='Linear Attenuation',
                                         max=1.0,
                                         resolution=0.01,
                                         value=0.0)
        self.pLinearAttenuation['command'] = self.setLinearAttenuation
        self.pLinearAttenuation.pack(fill=tkinter.X, expand=0)
        self.bind(self.pLinearAttenuation,
                  'Set point light linear attenuation')

        self.pQuadraticAttenuation = Slider(pointPage,
                                            text='Quadratic Attenuation',
                                            max=1.0,
                                            resolution=0.01,
                                            value=0.0)
        self.pQuadraticAttenuation['command'] = self.setQuadraticAttenuation
        self.pQuadraticAttenuation.pack(fill=tkinter.X, expand=0)
        self.bind(self.pQuadraticAttenuation,
                  'Set point light quadratic attenuation')

        # Spot light controls
        self.sSpecularColor = seColorEntry(spotPage, text='Specular Color')
        self.sSpecularColor['command'] = self.setSpecularColor
        self.sSpecularColor.pack(fill=tkinter.X, expand=0)
        self.bind(self.sSpecularColor, 'Set spot light specular color')

        self.sConstantAttenuation = Slider(spotPage,
                                           text='Constant Attenuation',
                                           max=1.0,
                                           resolution=0.01,
                                           value=1.0)
        self.sConstantAttenuation['command'] = self.setConstantAttenuation
        self.sConstantAttenuation.pack(fill=tkinter.X, expand=0)
        self.bind(self.sConstantAttenuation,
                  'Set spot light constant attenuation')

        self.sLinearAttenuation = Slider(spotPage,
                                         text='Linear Attenuation',
                                         max=1.0,
                                         resolution=0.01,
                                         value=0.0)
        self.sLinearAttenuation['command'] = self.setLinearAttenuation
        self.sLinearAttenuation.pack(fill=tkinter.X, expand=0)
        self.bind(self.sLinearAttenuation, 'Set spot light linear attenuation')

        self.sQuadraticAttenuation = Slider(spotPage,
                                            text='Quadratic Attenuation',
                                            max=1.0,
                                            resolution=0.01,
                                            value=0.0)
        self.sQuadraticAttenuation['command'] = self.setQuadraticAttenuation
        self.sQuadraticAttenuation.pack(fill=tkinter.X, expand=0)
        self.bind(self.sQuadraticAttenuation,
                  'Set spot light quadratic attenuation')

        self.sExponent = Slider(spotPage,
                                text='Exponent',
                                max=1.0,
                                resolution=0.01,
                                value=0.0)
        self.sExponent['command'] = self.setExponent
        self.sExponent.pack(fill=tkinter.X, expand=0)
        self.bind(self.sExponent, 'Set spot light exponent')

        # MRM: Add frustum controls

        self.lightNotebook.setnaturalsize()
        self.lightNotebook.pack(expand=1, fill=tkinter.BOTH)

        mainFrame.pack(expand=1, fill=tkinter.BOTH)
Exemple #24
0
    def __init__(self, *args, **kwargs):
        Page.__init__(self, *args, **kwargs)

        self.configuration = Configuration().load_configuration()
        self.api = WalletAPI()
        self.tokens = self.api.list_tokens(self.configuration)
        self.eth_balance, _ = self.api.get_balance(self.configuration)

        def change_token(token):
            if token == 'ETH':
                self.eth_balance, _ = self.api.get_balance(self.configuration)
            else:
                self.eth_balance, _ = self.api.get_balance(self.configuration, token)

            balance.set(str(self.eth_balance) + ' ' + token)

        token_symbol = StringVar()
        token_symbol.set('ETH')
        balance = StringVar()
        balance.set(str(self.eth_balance) + ' ' + token_symbol.get())

        mb = Menubutton(self,
                        width=60,
                        textvariable=token_symbol,
                        relief=RAISED)
        mb.grid()
        mb.menu = Menu(mb, tearoff=0)
        mb["menu"] = mb.menu
        mb.menu.add_radiobutton(label="ETH",
                                variable=token_symbol,
                                value='ETH',
                                command=lambda: change_token(token_symbol.get()))
        for token in self.tokens:
            mb.menu.add_radiobutton(label=token,
                                    variable=token_symbol,
                                    value=token,
                                    command=lambda: change_token(token_symbol.get()))
        mb.pack()

        label = Label(self,
                      textvariable=balance,
                      width=60,
                      font=(None, 30))
        label.pack()

        lbl_address = Label(self,
                            text="To address:",
                            width=60,
                            font=(None, 20))
        lbl_address.pack()

        entry_address = Entry(self,
                              font=(None, 20),
                              width=60,
                              justify=CENTER)
        entry_address.pack()

        lbl_amount = Label(self,
                           text="Amount:",
                           width=60,
                           font=(None, 20))
        lbl_amount.pack()

        entry_amount = Entry(self,
                             font=(None, 20),
                             width=60,
                             justify=CENTER)
        entry_amount.pack()

        lbl_passphrase = Label(self,
                               text="Passphrase:",
                               width=60,
                               font=(None, 20))
        lbl_passphrase.pack()

        entry_passphrase = Entry(self,
                                 font=(None, 20),
                                 width=60,
                                 justify=CENTER)
        entry_passphrase.pack()

        btn_send = Button(self,
                          text="Send",
                          width=60,
                          font=(None, 16),
                          command=lambda: self.send_transaction(entry_address.get(),
                                                                entry_amount.get(),
                                                                entry_passphrase.get(),
                                                                token_symbol.get()))
        btn_send.pack()

        btn_back = Button(self,
                          text="Back",
                          width=60,
                          font=(None, 16),
                          command=self.navigate_home_page)
        btn_back.pack()
Exemple #25
0
    def __init__(self, *args, **kwargs):
        Page.__init__(self, *args, **kwargs)

        self.configuration = Configuration().load_configuration()
        self.api = WalletAPI()
        self.tokens = self.api.list_tokens(self.configuration)
        self.eth_balance, self.address = self.api.get_balance(self.configuration)

        def refresh():
            change_token(token_symbol.get())

        def change_token(token):
            if token == 'ETH':
                self.eth_balance, self.address = self.api.get_balance(self.configuration)
            else:
                self.eth_balance, self.address = self.api.get_balance(self.configuration, token)
            balance.set(str(self.eth_balance) + ' ' + token)

        token_symbol = StringVar()
        token_symbol.set('ETH')
        balance = StringVar()
        balance.set(str(self.eth_balance) + ' ' + token_symbol.get())

        mb = Menubutton(self,
                        width=60,
                        textvariable=token_symbol,
                        relief=RAISED)
        mb.grid()
        mb.menu = Menu(mb, tearoff=0)
        mb["menu"] = mb.menu
        mb.menu.add_radiobutton(label="ETH",
                                variable=token_symbol,
                                value='ETH',
                                command=lambda: change_token(token_symbol.get()))
        for token in self.tokens:
            mb.menu.add_radiobutton(label=token,
                                    variable=token_symbol,
                                    value=token,
                                    command=lambda: change_token(token_symbol.get()))
        mb.menu.add_radiobutton(label="Add new token ...",
                                command=self.navigate_add_token_page)
        mb.pack()

        label_address_lbl = Label(self,
                                  text='Address:',
                                  width=60,
                                  font=(None, 10, "bold"))
        label_address_lbl.pack()
        label_address = Label(self,
                              text=self.address,
                              width=60,
                              font=(None, 10))
        label_address.pack()

        label_balance = Label(self,
                              textvariable=balance,
                              width=60,
                              font=(None, 30))
        label_balance.pack()

        btn_refresh = Button(self,
                             text="Refresh",
                             command=refresh,
                             width=60,
                             font=(None, 16))
        btn_refresh.pack()

        btn_copy_address = Button(self,
                                  text="Copy address",
                                  command=self.copy_address,
                                  width=60,
                                  font=(None, 16))
        btn_copy_address.pack()

        btn_send_transaction = Button(self,
                                      text="Send Transaction",
                                      command=self.navigate_transaction_page,
                                      width=60,
                                      font=(None, 16))
        btn_send_transaction.pack()
Exemple #26
0
"""
    Menubutton example
"""
from tkinter import Tk, Menubutton, Menu
from tkinter import RAISED

root = Tk()
mbutton = Menubutton(root, text='Food')  # the pull-down stands alone
picks = Menu(mbutton)
mbutton.config(menu=picks)
picks.add_command(label='spam', command=root.quit)
picks.add_command(label='eggs', command=root.quit)
picks.add_command(label='bacon', command=root.quit)
mbutton.pack()
mbutton.config(bg='white', bd=4, relief=RAISED)
root.mainloop()
Exemple #27
0
from tkinter import (
    Tk, Menubutton, RAISED, Menu, IntVar
)

layar = Tk()
layar.title("Menu Button")
layar.geometry("300x100")

mb = Menubutton( master=layar, text="condiment", relief=RAISED)
mb.grid()
mb.menu = Menu( master=mb, tearoff=0)

mb["menu"] = mb.menu

mayoVar = IntVar()
ketchVar = IntVar()

mb.menu.add_checkbutton(label="mayo", variable=mayoVar)
mb.menu.add_checkbutton(label="ketch", variable=ketchVar)

mb.pack()

layar.mainloop()
Exemple #28
0
    print("Python " + str(variablepython.get()))


def toggleJavaFun():
    print("Java " + str(variablejava.get()))


def toggleRadio():
    print("Radio : " + str(radio_val.get()))


frame = Frame(window, relief=RAISED, borderwidth=1)
frame.pack(fill=X)

#First Menu
first_menu = Menubutton(frame, text="File")
first_menu.pack(padx=3, pady=3, side=LEFT)
first_menu.menu = Menu(first_menu, tearoff=False)
first_menu.menu.add_command(label="New", command=newFile)
first_menu.menu.add_command(label="Open", command=openFile)
first_menu.menu.add("separator")
first_menu.menu.add_command(label="Exit", command=exitMenu)
first_menu['menu'] = first_menu.menu

#second Menu
second_menu = Menubutton(frame, text="Edit")
second_menu.pack(padx=3, pady=3, side=LEFT)
second_menu.menu = Menu(second_menu, tearoff=False)
second_menu.menu.add_command(label="DELETE ALL", command=delFile)
second_menu.menu.add_command(label="CLOSE", command=closeFile)
second_menu.menu.add("separator")
Exemple #29
0
def RoomAvailibity():
    currentDate = datetime.datetime.now()
    currentDay = date.today()  #current date for schedule
    nextDay1 = date.today() + datetime.timedelta(days=1)
    nextDay2 = date.today() + datetime.timedelta(days=2)
    nextDay3 = date.today() + datetime.timedelta(days=3)
    nextDay4 = date.today() + datetime.timedelta(days=4)
    nextDay5 = date.today() + datetime.timedelta(days=5)
    nextDay6 = date.today() + datetime.timedelta(days=6)
    nextDay7 = date.today() + datetime.timedelta(days=7)

    year = currentDate.year
    day = currentDate.day
    month = currentDate.month

    # root=Tk()
    # root.title("Key")
    # root.geometry("200x200+1000+100")
    c2window = Tk()
    c2window.title("Available rooms")
    c2window.geometry("1000x600+10+100")
    conn = sqlite3.connect('hotel.db')
    cur = conn.cursor()
    sql = ' SELECT * FROM Room'
    cur.execute(sql)
    getAll = cur.fetchall()
    print(getAll[0])

    def checkIn(h):
        c2window.destroy()
        room(h)

    a = 99

    for row in range(22):

        for column in range(9):

            if row == 0:  #day of the week
                lable0 = Label(c2window,
                               text="Room Number",
                               bg="black",
                               fg="white",
                               padx=3,
                               pady=3)
                lable0.grid(row=0, column=0, sticky="nsew", padx=1, pady=1)
                lable3 = Label(c2window,
                               text=currentDay.strftime('%A'),
                               bg="black",
                               fg="white",
                               padx=3,
                               pady=3)
                lable3.grid(row=0, column=1, sticky="nsew", padx=1, pady=1)
                lable4 = Label(c2window,
                               text=nextDay1.strftime('%A'),
                               bg="black",
                               fg="white",
                               padx=3,
                               pady=3)
                lable4.grid(row=0, column=2, sticky="nsew", padx=1, pady=1)
                lable3 = Label(c2window,
                               text=nextDay2.strftime('%A'),
                               bg="black",
                               fg="white",
                               padx=3,
                               pady=3)
                lable3.grid(row=0, column=3, sticky="nsew", padx=1, pady=1)
                lable3 = Label(c2window,
                               text=nextDay3.strftime('%A'),
                               bg="black",
                               fg="white",
                               padx=3,
                               pady=3)
                lable3.grid(row=0, column=4, sticky="nsew", padx=1, pady=1)
                lable3 = Label(c2window,
                               text=nextDay4.strftime('%A'),
                               bg="black",
                               fg="white",
                               padx=3,
                               pady=3)
                lable3.grid(row=0, column=5, sticky="nsew", padx=1, pady=1)
                lable3 = Label(c2window,
                               text=nextDay5.strftime('%A'),
                               bg="black",
                               fg="white",
                               padx=3,
                               pady=3)
                lable3.grid(row=0, column=6, sticky="nsew", padx=1, pady=1)
                lable3 = Label(c2window,
                               text=nextDay6.strftime('%A'),
                               bg="black",
                               fg="white",
                               padx=3,
                               pady=3)
                lable3.grid(row=0, column=7, sticky="nsew", padx=1, pady=1)
                lable3 = Label(c2window,
                               text=nextDay7.strftime('%A'),
                               bg="black",
                               fg="white",
                               padx=3,
                               pady=3)
                lable3.grid(row=0, column=8, sticky="nsew", padx=1, pady=1)
            elif row == 1:  #date
                lable2 = Label(c2window,
                               text=str(currentDay.month) + "/" +
                               str(currentDay.day))
                lable2.grid(row=1, column=1, sticky="nsew", padx=1, pady=1)
                lable2 = Label(c2window,
                               text=str(nextDay1.month) + "/" +
                               str(nextDay1.day))
                lable2.grid(row=1, column=2, sticky="nsew", padx=1, pady=1)
                lable2 = Label(c2window,
                               text=str(nextDay2.month) + "/" +
                               str(nextDay2.day))
                lable2.grid(row=1, column=3, sticky="nsew", padx=1, pady=1)
                lable2 = Label(c2window,
                               text=str(nextDay3.month) + "/" +
                               str(nextDay3.day))
                lable2.grid(row=1, column=4, sticky="nsew", padx=1, pady=1)
                lable2 = Label(c2window,
                               text=str(nextDay4.month) + "/" +
                               str(nextDay4.day))
                lable2.grid(row=1, column=5, sticky="nsew", padx=1, pady=1)
                lable2 = Label(c2window,
                               text=str(nextDay5.month) + "/" +
                               str(nextDay5.day))
                lable2.grid(row=1, column=6, sticky="nsew", padx=1, pady=1)
                lable2 = Label(c2window,
                               text=str(nextDay6.month) + "/" +
                               str(nextDay6.day))
                lable2.grid(row=1, column=7, sticky="nsew", padx=1, pady=1)
                lable2 = Label(c2window,
                               text=str(nextDay7.month) + "/" +
                               str(nextDay7.day))
                lable2.grid(row=1, column=8, sticky="nsew", padx=1, pady=1)

            elif column == 0:
                a += 1
                label = Label(c2window, text=a)
                label.grid(row=row,
                           column=column,
                           sticky="nsew",
                           padx=1,
                           pady=1)
            else:

                label6 = Menubutton(c2window, text="Available")
                label6.grid(row=row,
                            column=column,
                            sticky="nsew",
                            padx=1,
                            pady=1)
                c2window.grid_columnconfigure(column, weight=1, uniform=1)
                label6.menu = Menu(label6)
                label6["menu"] = label6.menu
                if column == 1:
                    label6.menu.add_command(
                        label="check In",
                        command=lambda roomNumber=a: checkIn(roomNumber))
                else:
                    label6.menu.add_command(
                        label="Reservation",
                        command=lambda roomNumber=a: reservationSystem())
                # lambda  h = h ,row= row, column=column, l= label : availableRoom(row,column,h,l))
                # label.menu.add_command (label = "Reservation", command=lambda  h= h, row= row, column=column, l= label : occupiedRoom(row,column,h,l))

    def loadCheckin():
        conn = sqlite3.connect('hotel.db')
        cur = conn.cursor()
        sql = ' SELECT * FROM Room WHERE CheckIN =  ' + str(1)
        cur.execute(sql)
        result = cur.fetchall()

        def loadrooms(row, column, first_name):
            widget = c2window.grid_slaves(row=row, column=column)[0]
            widget.configure(bg="blue", fg="white", text=first_name)

        for row in result:
            if row[2] == 'Unavailable/Occupied':
                cur = conn.cursor()
                # sql = 'SELECT first_name, last_name FROM guests WHERE guest_id=' + str(row[6])
                # sql= 'SELECT CheckInDate , CheckOutDate from Room UNION ALL SELECT  first_name, last_name from guests WHERE guest_id=' +str(row[6])
                sql = 'SELECT RoomNumber,first_name, last_name, CheckInDate, CheckOutDate from guests INNER JOIN Room on Room.guestID = guests.guest_id'
                cur.execute(sql)
                guest = cur.fetchall()

        for row in guest:
            print(row)
            year1, month1, day1 = map(int, row[4].split('/'))
            d = date(year1, month1, day1)
            year, month, day = map(int, row[3].split('/'))
            c = date(year, month, day)
            days = (d - c).days
            cur = conn.cursor()
            # sql = 'SELECT first_name, last_name FROM guests WHERE guest_id=' + str(row[6])
            # sql= 'SELECT CheckInDate , CheckOutDate from Room UNION ALL SELECT  first_name, last_name from guests WHERE guest_id=' +str(row[6])
            sql = 'SELECT RowX, ColumnY FROM RoomAvailability WHERE RoomNumber =' + row[
                0]
            cur.execute(sql)
            roomHere = cur.fetchall()
            print(days)
            if days == 0:
                loadrooms(roomHere[0][0], roomHere[0][1], row[1])
            elif days == 1:
                loadrooms(roomHere[0][0], roomHere[0][1], row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 1, row[1])

            elif days == 2:
                loadrooms(roomHere[0][0], roomHere[0][1], row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 1, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 2, row[1])
            elif days == 3:
                loadrooms(roomHere[0][0], roomHere[0][1], row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 1, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 2, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 3, row[1])
            elif days == 4:
                loadrooms(roomHere[0][0], roomHere[0][1], row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 1, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 2, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 3, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 4, row[1])
            elif days == 5:
                loadrooms(roomHere[0][0], roomHere[0][1], row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 1, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 2, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 3, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 4, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 5, row[1])
            elif days == 6:
                loadrooms(roomHere[0][0], roomHere[0][1], row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 1, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 2, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 3, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 4, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 5, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 6, row[1])
            elif days == 7:
                loadrooms(roomHere[0][0], roomHere[0][1], row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 1, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 2, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 3, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 4, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 5, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 6, row[1])
                loadrooms(roomHere[0][0], roomHere[0][1] + 7, row[1])

    loadCheckin()
Exemple #30
0
    def __init__(self):
        super().__init__()
        self.activePlayers = Game.getPlayers()

        self.title("Alcohol Game")
        self.resizable(width=False, height=False)
        self.geometry('750x320')

        self.calc_label = Label(self, text="Calculations", font="lucida 11 bold")
        self.calc_label.place(x=20, y=10)

        # --- Participants Multiple Selection Combobox ---
        # Label
        self.label1 = Label(self, text="Participants:")
        self.label1.place(x=10, y=40)

        # Multiple selection combobox
        self.player_combobox = Menubutton(self, text="_______", borderwidth=1, indicatoron=True)
        self.player_combobox_values = Menu(self.player_combobox, tearoff=False)
        self.player_combobox.configure(menu=self.player_combobox_values)
        self.player_combobox.place(x=90, y=40)
        self.players = {}
        for player in Game.getPlayers():
            self.players[player] = tk.IntVar(value=1)
            self.player_combobox_values.add_checkbutton(label=player, variable=self.players[player],
                    onvalue=1, offvalue=0, command=self.setActivePlayers)

        # ---   Date1 to Date2 Seleciton   ---
        self.date1 = tk.StringVar()
        self.date1.set("4/20/20")
        self.date2 = tk.StringVar()
        self.date2.set(datetime.today().strftime("%#m/%#d/%y"))
        # Date1
        self.date1_entry = Entry(self, textvariable=self.date1)
        self.date1_entry.place(x=10, y=70, width=60)
        # Date2
        self.date2_entry = Entry(self, textvariable=self.date2)
        self.date2_entry.place(x=90, y=70, width=60)
        # Labels
        self.label2 = Label(self, text="to")
        self.label2.place(x=72, y=70)

        # ---   Submit Button   ---
        self.submit_btn1 = Button(self, text="Submit", command=self.submitData)
        self.submit_btn1.place(x=90, y=100)

        # Seperator
        self.seperator = ttk.Separator(self, orient=tk.HORIZONTAL)
        self.seperator.place(x=10, y=145, width=180)

        # ---   Add Score   ---
        self.date = tk.StringVar()
        self.name = tk.StringVar()
        self.pct = tk.StringVar()
        self.oz = tk.StringVar()
        # Labels
        self.score_label = Label(self, text="Add Score", font="lucida 11 bold")
        self.score_label.place(x=20, y=160)
        self.label4 = Label(self, text="Date: ")
        self.label4.place(x=10, y=190)
        self.label5 = Label(self, text="Name: ")
        self.label5.place(x=10, y=220)
        self.label6 = Label(self, text="Pct: ")
        self.label6.place(x=10, y=250)
        self.label7 = Label(self, text="Oz: ")
        self.label7.place(x=85, y=250)
        # Name
        self.name_entry = Entry(self, textvariable=self.date)
        self.name_entry.place(x=52, y=190)
        self.date_entry = Entry(self, textvariable=self.name)
        self.date_entry.place(x=60, y=220)
        self.pct_entry = Entry(self, textvariable=self.pct)
        self.pct_entry.place(x=45, y=250, width=30)
        self.oz_entry = Entry(self, textvariable=self.oz)
        self.oz_entry.place(x=115, y=250, width=30)

        # ---   Submit Button   ---
        self.submit_btn2 = Button(self, text="Submit", command=self.submitScore)
        self.submit_btn2.place(x=90, y=280)