Example #1
0
    def prod():
        root2 = Tk()
        root2.geometry('400x170+450+250')
        root2.title('Продукты в АТБ')

        def prodi():
            global user_input
            user_input = (entry_1.get())
            root2.destroy()

        def how_much():
            window = Tk()
            window.geometry('300x250+530+180')
            lbl0 = Label(window,
                         text='У Вас примерно:',
                         font=("Cambria", 22),
                         fg="blue")
            lbl0.place(x=60, y=10)
            lbl = Label(window, text=[money], font=("Cambria", 40), fg="blue")
            lbl.place(x=100, y=60)
            lbl1 = Label(window, text='Грв.', font=("Cambria", 20), fg="blue")
            lbl1.place(x=100, y=150)
            window.after(2000, lambda: window.destroy())
            window.mainloop()

        def end():
            pass

        label = Label(root2,
                      text="Какой продукт берём?",
                      fg='#000875',
                      font=("Cambria", 20))
        entry_1 = Entry(root2,
                        font=("Ubuntu", 20),
                        fg='#000875',
                        bg='LightCyan',
                        justify='center')
        text = Label(root2,
                     text='Название продукта:',
                     fg='#DA0700',
                     font='Cambria')
        btn = Button(root2,
                     text="Беру!",
                     command=prodi,
                     bg="lime",
                     font='Cambria')
        btn2 = Button(root2,
                      text="Сейчас у маня...",
                      command=how_much,
                      bg="LightGray",
                      font='Cambria')
        btn3 = Button(root2, text="Хорош", command=end, font='Cambria')
        label.place(x=50, y=10)
        text.place(x=110, y=50)
        entry_1.place(x=40, y=70)
        entry_1.focus_set()
        btn.place(x=40, y=120)
        btn2.place(x=190, y=120)
        btn3.place(x=320, y=120)
        root2.mainloop()
def makesure(skin):
    def delt():
        cv2.destroyWindow("frame")
        cv2.destroyWindow("RESULT")
        root2.destroy()
    def suss():
        save()
        cv2.destroyWindow("frame")
        cv2.destroyWindow("RESULT")
        root2.destroy()
    root2 = Tk() # 初始化Tk()
    root2.title("INDEX")    # 设置窗口标题
    root2.geometry("400x400")    # 设置窗口大小 注意:是x 不是*
    root2.resizable(width=True, height=True) # 设置窗口是否可以变化长/宽,False不可变,True可变,默认为True
    root2.tk.eval('package require Tix')  #引入升级包,这样才能使用升级的组合控件

    lable = Label(root2, text="Do u want to save the result pic?", bg="blue",bd=10, font=("Arial",12), width=30, height=3)
    lable.pack(side=TOP)

    button=Button(root2,text='Confirm',command=suss,activeforeground="black",activebackground='blue',bg='green',fg='white')
    button.pack(side=BOTTOM)

    button=Button(root2,text='Delete',command=delt,activeforeground="black",activebackground='blue',bg='red',fg='white')
    button.pack(side=BOTTOM)

    cv2.namedWindow("RESULT", cv2.WINDOW_GUI_EXPANDED)
    cv2.imshow("RESULT",skin)

    root2.mainloop()
Example #3
0
 def stop_climbing():
     root6 = Tk()
     root6.geometry('600x130+400+300')
     story = Label(root6,
                   text='''Возможно у Вас недостаточно денег,
 для будущих покупок! Пройдите к кассе!''',
                   font=('Arial', 20),
                   fg='blue')
     story.place(x=5, y=20)
     root6.after(2000, lambda: root6.destroy())
     root6.mainloop()
Example #4
0
def speak():
    root8 = Tk()
    root8.geometry('420x100+550+200')
    lbl = Label(root8,
                text='''Если Вам интересны наши цены
    подойдите к табличке!''',
                font=("Cambria", 20),
                fg="DarkSlateBlue")
    lbl.place(x=1, y=15)
    root8.after(2000, lambda: root8.destroy())
    root8.mainloop()
Example #5
0
def sms():
    # Вы оплатили товар
    root3 = Tk()
    root3.geometry("500x200+350+250")
    root3.title('Window name')
    root3['bg'] = '#FFA07A'

    def goodluck():
        sl.destroy()
        btn1.destroy()
        btn2.destroy()
        gd = Label(root3,
                   text="Хорошего Вам дня!",
                   font="Broadway 20",
                   fg="green",
                   bg="#C0C0C0")
        gd.place(x=120, y=70)

    def shet():
        sl.destroy()
        btn1.destroy()
        btn2.destroy()
        gd = Label(root3,
                   text="Вызываем полицию?",
                   font="Broadway 20",
                   fg="black",
                   bg="#C0C0C0")
        gd.place(x=100, y=70)

    sl = Label(text='У Вас оплачены продукты?',
               font='Comfortaa 20',
               fg='black',
               bg='#FFA07A')
    btn1 = Button(root3,
                  text='ДА',
                  bg='#228B22',
                  fg='#ccc',
                  width=13,
                  height=3,
                  command=goodluck)
    btn2 = Button(root3,
                  text='НЕТ',
                  bg='#FF0000',
                  fg='#ccc',
                  width=13,
                  height=3,
                  command=shet)
    sl.pack()
    btn1.place(x=120, y=80)
    btn2.place(x=270, y=80)

    root3.mainloop()
Example #6
0
def mainctrl():
    mc = Tk()
    mc.title("主动控制")
    mc.geometry("250x250")
    bup = Button(mc, text="向上")
    bdown = Button(mc, text="向下")
    bleft = Button(mc, text="向左")
    bright = Button(mc, text="向右")
    bup.pack()
    bdown.pack()
    bleft.pack()
    bright.pack()
    mc.mainloop()
Example #7
0
def navigation():
    navi = Tk()
    navi.title("自主导航")
    navi.geometry("250x250")
    b1 = Button(navi, text="显示位置")
    b1.pack()
    b2 = Button(navi, text="设置目标点")
    b2.pack()
    b3 = Button(navi, text="建立地图")
    b3.pack()

    bright = Button(navi, text="开始导航", )
    bright.pack()
    navi.mainloop()
Example #8
0
 def how_much():
     window = Tk()
     window.geometry('300x250+530+180')
     lbl0 = Label(window,
                  text='У Вас примерно:',
                  font=("Cambria", 22),
                  fg="blue")
     lbl0.place(x=60, y=10)
     lbl = Label(window, text=[money], font=("Cambria", 40), fg="blue")
     lbl.place(x=100, y=60)
     lbl1 = Label(window, text='Грв.', font=("Cambria", 20), fg="blue")
     lbl1.place(x=100, y=150)
     window.after(2000, lambda: window.destroy())
     window.mainloop()
Example #9
0
def no_product():
    root4 = Tk()
    root4.geometry('700x100+300+250')
    root4.title('Нет продукта')
    root4['bg'] = 'PapayaWhip'
    text2 = Label(root4,
                  text='Извините, такого продукта в нашем магазине нет!',
                  bg='PapayaWhip',
                  fg='Red',
                  font=('Comfortaa', 16))
    text2.place(x=30, y=20)

    root4.after(1000, lambda: root4.destroy())
    root4.mainloop()
Example #10
0
def yes():
    global money
    money = float(entry_1.get())
    win = Tk()
    win.geometry('300x250+530+180')
    lbl0 = Label(win, text='У Вас с собой:', font=("Cambria", 20), fg="blue")
    lbl0.place(x=60, y=10)
    lbl = Label(win, text=[money], font=("Cambria", 40), fg="blue")
    lbl.place(x=100, y=60)
    lbl1 = Label(win, text='Грв.', font=("Cambria", 30), fg="blue")
    lbl1.place(x=100, y=150)
    root1.destroy()
    win.after(1000, lambda: win.destroy())
    win.mainloop()
    print(money)
Example #11
0
def store_products():
    root7 = Tk()
    root7.geometry('830x300+300+230')
    story = Label(root7,
                  text='''В магазине сегодня распродажа!                    

    масло   -  54 грн           мясо    - 110 грн          капуста - 13 грн
    сахар   -  24.80 грн        рыба    - 80 грн           лук     - 12 грн
    молоко  -  26 грн           колбаса - 60 грн           хлеб    - 15 грн

    яйца    -  32.50 грн        рис     - 24.60 грн
    майонез -  28.90 грн        гречка  - 38.40 грн
                                                                                                    ''',
                  font=('Arial', 20),
                  fg='blue')
    story.pack()
    root7.after(4000, lambda: root7.destroy())
    root7.mainloop()
Example #12
0
def main_page(root_function):
    global Algorithm_choice
    Algorithm_choice = 0

    root_function.destroy()

    root = Tk()
    root.title("A Compressed Software By Wang,Xu,Wu,Huang")
    root.geometry("999x666")
    root.resizable(width=True, height=True)
    root.eval('package require Tix')
    root['bg'] = '#FFFAF0'
    text1 = Label(root,
                  text="-⭐-Choose the compressed algorithm you want-⭐-",
                  bg="#FFFAF0",
                  fg="BLACK",
                  font=("黑体", 25),
                  width=50,
                  height=2,
                  anchor="center")
    text1.place(x=70, y=40)
    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=480)

    button1_1 = Button(root,
                       text="Huffman",
                       font=("宋体", 25),
                       command=lambda: algorithm(1, root),
                       width=15,
                       height=2,
                       bg="#FFE4C4")
    button1_1.place(x=70, y=300)

    button1_2 = Button(root,
                       text="Zip",
                       font=("宋体", 25),
                       command=lambda: algorithm(2, root),
                       width=15,
                       height=2,
                       bg="#F4A460")
    button1_2.place(x=363, y=300)

    button1_3 = Button(root,
                       text="Lz4",
                       font=("宋体", 25),
                       command=lambda: algorithm(3, root),
                       width=15,
                       height=2,
                       bg="#CD5C5C")
    button1_3.place(x=656, y=300)

    button1_4 = Button(root,
                       text="Exit",
                       font=("宋体", 15),
                       command=lambda: sys.exit(),
                       width=5,
                       height=1,
                       bg="#E9967A")
    button1_4.place(x=860, y=600)

    root.mainloop()
Example #13
0
#!/usr/bin/env python

from tkinter import Label, Button, END
from tkinter.tix import Tk, Control, ComboBox

top = Tk()
top.tk.eval('package require Tix')

lb = Label(top, text = 'Animals (in parirs; min : pair, max : dozen)')
lb.pack()

ct = Control(top, label = 'Number:', integer = True, max = 12, min = 2, value = 2, step = 2)
ct.label.config(font = 'Helvetica -14 bold')
ct.pack()

cb = ComboBox(top, label = 'Type:', editable = True)
for animal in ('dog', 'cat', 'hamster', 'python'):
    cb.insert(END, animal)
cb.pack()

qb = Button(top, text = 'Quit', command = top.quit, bg = 'red', fg = 'white')
qb.pack()

top.mainloop()
Example #14
0
class DbGui:
    db = None
    current_table = None

    def __init__(self):
        # init window
        self.root = Tk()
        self.root.title("dbTools")
        self.root.geometry('960x480')
        self.left = Treeview(self.root)
        self.right = Treeview(self.root)
        self.main_menu = Menu(self.root)
        self.init_left()
        self.init_right()
        self.init_main_menu()
        self.root.config(menu=self.main_menu)
        self.root.bind('Button-3', self.popup_menu)

    def connect_db(self, database=None):
        if database is None:
            self.db = GetMysqlTableComments()
        else:
            self.db = GetMysqlTableComments(database=database)
        self.set_left(self.db.get_tables())

    def start(self):
        self.connect_db()
        self.root.mainloop()
        self.close()

    def init_left(self):
        self.left["columns"] = ("1", "2")
        self.left["show"] = "headings"
        self.left.column("1", width=50, anchor='center')
        self.left.column("2", width=50, anchor='center')
        self.left.heading("1", text="table")
        self.left.heading("2", text="comment")
        self.left.insert('', 'end', values=('1', '2'))
        self.left.place(relx=0, rely=0, relwidth=0.2, relheight=1)
        self.left.bind('<ButtonRelease-1>', self.left_click)

    def right_click(self, event):
        if self.current_table is None:
            print('please choose table!')
            return
        selection = []
        for item in self.right.selection():
            item_text = self.right.item(item, "values")
            selection.append(item_text[0])
        self.current_table.set_selects(selection)

    def left_click(self, event):
        for item in self.left.selection():
            item_text = self.left.item(item, "values")
            sql_columns = self.db.get_columns(item_text[0])
            fields = get_fields_from_sql_columns(sql_columns)
            self.current_table = Table(item_text, fields)
            self.set_right(get_columns_from_fields(fields))
            break

    def init_right(self):
        self.right["columns"] = ("1", "2", "3", "4", "5", "6")
        self.right["show"] = "headings"
        self.right.column("1", width=50, anchor='center')
        self.right.column("2", width=50, anchor='center')
        self.right.column("3", width=50, anchor='center')
        self.right.column("4", width=50, anchor='center')
        self.right.column("5", width=50, anchor='center')
        self.right.column("6", width=50, anchor='center')
        self.right.heading("1", text="column")
        self.right.heading("2", text="key")
        self.right.heading("3", text="java type")
        self.right.heading("4", text="sql type")
        self.right.heading("5", text="max size")
        self.right.heading("6", text="comment")
        self.right.place(relx=0.2, rely=0, relwidth=0.8, relheight=1)
        self.right.bind('<ButtonRelease-1>', self.right_click)

    def set_left(self, values):
        replace_tree_view(self.left, values)

    def set_right(self, values):
        replace_tree_view(self.right, values)

    def init_main_menu(self):
        # 被注释代码为在菜单嵌入子菜单
        # menu_run = Menu(self.main_menu)
        # self.main_menu.add_cascade(label="运行", menu=menu_run)
        self.main_menu.add_command(label="生成", command=self.generate)
        # menu_run.add_separator()
        self.main_menu.add_command(label="退出", command=self.root.destroy)

    def close(self):
        if self.db.connected:
            self.db.close_db()
        print('---closed---')

    def generate(self):
        if self.current_table is None:
            print('please choose table!')
            return
        print('---start generate---')
        self.current_table.generate()
        print('---end generate---')

    def popup_menu(self, event):
        self.main_menu.post(event.x_root, event.y_root)
Example #15
0
from tkinter.tix import Tk

h = Tk()

#creating gui
h.title("Hangman Game")
h.geometry("500x500")
#h.configure(bg = 'white')

label = Label(
    h,
    text="Enter in your guess:",
).place(x=10, y=180)
#label1 = Label(h, bg = 'white', text = "The number of letters in the ranodm word is: %s." %(letterNumberStr))
#label1.place(x = 10, y = 120)

input_box = Entry(h)
input_box.place(x=10, y=200)

#A canvas is needed so I can draw
canvas = Canvas(
    h, bg='white')  # used white background to tell where structure was at
canvas.place(x=325, y=200, width=350, height=50)

canvas.create_line(10, 400, 100, 400)  #scaffoldPart1
canvas.create_line(30, 400, 30, 50)  #scaffoldPart2
canvas.create_line(30, 50, 250, 50)  #scaffoldPart3
canvas.create_line(175, 50, 175, 100)  #rope

h.mainloop()
Example #16
0
class Karaoke():
    def __init__(self):

        print('Pyhon version {}.{}.{}'.format(*sys.version_info))

        #     print(os.getenv('PATH')) # Get the environment path variable
        #     print(os.getcwd())

        # Placeholder
        #         self.currentSong = {'src' : 'musics/Vietnamese/Tre Productions - Nguoi Ay Va Toi Em Phai Cho Ai/Anh Co Quen Em - Cam Ly and VQL.vob', 'track' : 2}
        self.currentSong = {
            'src': 'musics/Vietnamese/Ai Lên Xứ Hoa Đào - Sơn Ca.VOB',
            'track': 2
        }

        # Init GUI
        self.gui = Tk()
        self.gui.protocol("WM_DELETE_WINDOW", self.onDeleteWindow)
        self.gui.geometry("450x450")
        self.gui.title(self.currentSong['src'] + ' Track : ' +
                       str(self.currentSong['track']))

        self.guiContainer = Frame(self.gui)
        self.guiContainer.pack()

        self.instance = vlc.Instance()
        self.player = self.instance.media_player_new()
        self.vlcEvents = self.player.event_manager()
        self.vlcEvents.event_attach(vlc.EventType.MediaPlayerEndReached,
                                    self.onEndReached)
        #         self.player.set_media(self.instance.media_new('../../../' + self.currentSong['src']))
        #         self.player.play()

        slider = Scale(self.gui,
                       orient=HORIZONTAL,
                       length=300,
                       width=20,
                       sliderlength=10,
                       from_=0,
                       to=1000,
                       tickinterval=100)
        slider.pack()

        nextBtn = Button(self.guiContainer)
        nextBtn['text'] = "Next"
        nextBtn.bind("<Button-1>", self.onNextClick)
        nextBtn.pack()

        toggleTrackBtn = Button(self.guiContainer,
                                text="Toggle Track",
                                command=self.onToggleTrackBtnClick)
        toggleTrackBtn.pack()

        #     print('Pyhon version {}.{}.{}' . format(*sys.version_info))
        def setInterval(func, sec):
            def funcWrapper():
                setInterval(func, sec)
                func()

            self.timer = Timer(sec, funcWrapper)
            self.timer.start()
            return self.timer

#         self.timer = setInterval(self.get_playlist, 2)

        self.iniVLC(self.currentSong)

        # Windows only thing
        self.gui.mainloop()  # Only for Windows user for now

    def get_playlist(self):
        #         print('Running')
        r = requests.get('https://karaoke.firebaseio.com/playlist.json')
        songDict = r.json()
        # Sort the list
        listSorted = sorted(songDict.keys())
        # Get the first song hash
        firstSongOjbKey = listSorted[0]
        # Get the first song data
        songObj = songDict[firstSongOjbKey]

        if songObj['src'] != self.currentSong['src']:
            # Play new song
            self.iniVLC(songObj)
        else:
            if songObj['track'] != self.currentSong['track']:
                self.currentSong['track'] = songObj['track']
                self.player.audio_set_track(songObj['track'])

        return self.currentSong

    def iniVLC(self, sObj):
        self.currentSong = sObj

        #         self.mediaListPlayer = vlc.MediaL

        # Init VLC
        self.player.stop()
        #         self.player.set_media(self.instance.media_new('../../../' + self.currentSong['src']))
        path = os.path.join('../../../', self.currentSong['src'])

        o = '../../../musics/Vietnamese/Ai Lên Xứ Hoa Đào - Sơn Ca.VOB'
        u = o.encode('utf-8', 'strict')
        d = str(u)  # Convert to String
        n = d.replace("b'", "'")
        n = n.replace("'", '')

        w = '../../../musics/Vietnamese/Ai L\xc3\xaan X\xe1\xbb\xa9 Hoa \xc4\x90\xc3\xa0o - S\xc6\xa1n Ca.VOB'  # utf-8 bytes as a string
        print('w', type(w), w)

        l = '../../../musics/Vietnamese/Ai Lên Xứ Hoa Đào - Sơn Ca.VOB'
        print('l', type(l), l)

        print(w == n)

        #         ../../../musics/Vietnamese/Ai L\xc3\xaan X\xe1\xbb\xa9 Hoa \xc4\x90\xc3\xa0o - S\xc6\xa1n Ca.VOB
        #         self.player.set_media(self.instance.media_new('../../../musics/Vietnamese/Ai L\\\\xc3\\\\xaan X\\\\xe1\\\\xbb\\\\xa9 Hoa \\\\xc4\\\\x90\\\\xc3\\\\xa0o - S\\\\xc6\\\\xa1n Ca.VOB'))
        self.player.set_media(self.instance.media_new())
        #         self.player.set_media(self.instance.media_new(ub))
        self.player.play()

#         if sys.platform == "linux2": # for Linux using the X Server
#             self.player.set_xwindow(guiContainer.winfo_id())
#         elif sys.platform == "win32": # for Windows
#             self.player.set_hwnd(guiContainer.winfo_id())
#         elif sys.platform == "darwin": # for MacOS
#             self.player.set_agl(guiContainer.winfo_id())
#

    def onToggleTrackBtnClick(self):
        audioTrack = self.player.audio_get_track()
        trackNum = 1 if int(audioTrack) == 2 else 2
        self.player.audio_set_track(trackNum)
        print('onToggleTrackBtn click')

    def onNextClick(self, event):
        self.gui.destroy()

    def onEndReached(self, evt):
        print(evt)

    def onPlay(self, evt):
        print('onPlay')

    def onDeleteWindow(self):
        print('exit')
        self.gui.destroy()
        self.timer.cancel()
        #         os.abort()
        sys.exit()
Example #17
0
class Karaoke():
    
    def __init__(self):
        
        print('Pyhon version {}.{}.{}' . format(*sys.version_info))
    
        #     print(os.getenv('PATH')) # Get the environment path variable
        #     print(os.getcwd())

        # Placeholder
#         self.currentSong = {'src' : 'musics/Vietnamese/Tre Productions - Nguoi Ay Va Toi Em Phai Cho Ai/Anh Co Quen Em - Cam Ly and VQL.vob', 'track' : 2}
        self.currentSong = {'src' : 'musics/Vietnamese/Ai Lên Xứ Hoa Đào - Sơn Ca.VOB', 'track' : 2}
        
        # Init GUI
        self.gui = Tk()
        self.gui.protocol("WM_DELETE_WINDOW", self.onDeleteWindow)
        self.gui.geometry("450x450")
        self.gui.title(self.currentSong['src'] + ' Track : ' + str(self.currentSong['track']))
        
        self.guiContainer = Frame(self.gui)
        self.guiContainer.pack()
        
        self.instance = vlc.Instance()
        self.player = self.instance.media_player_new()
        self.vlcEvents = self.player.event_manager()
        self.vlcEvents.event_attach(vlc.EventType.MediaPlayerEndReached, self.onEndReached)
#         self.player.set_media(self.instance.media_new('../../../' + self.currentSong['src']))
#         self.player.play()
        
        slider = Scale(self.gui,orient=HORIZONTAL,length=300,width=20,sliderlength=10,from_=0,to=1000,tickinterval=100)
        slider.pack()

        nextBtn = Button(self.guiContainer)
        nextBtn['text'] = "Next"
        nextBtn.bind("<Button-1>", self.onNextClick)
        nextBtn.pack()
        
        toggleTrackBtn = Button(self.guiContainer, text="Toggle Track", command=self.onToggleTrackBtnClick)
        toggleTrackBtn.pack()
        
    #     print('Pyhon version {}.{}.{}' . format(*sys.version_info))
        def setInterval(func, sec):
            def funcWrapper():
                setInterval(func, sec)
                func()
            self.timer = Timer(sec, funcWrapper)
            self.timer.start()
            return self.timer
            
#         self.timer = setInterval(self.get_playlist, 2)
        
        self.iniVLC(self.currentSong)
        
        
        # Windows only thing    
        self.gui.mainloop() # Only for Windows user for now
        
    def get_playlist(self):
#         print('Running')
        r = requests.get('https://karaoke.firebaseio.com/playlist.json')
        songDict = r.json()
        # Sort the list
        listSorted = sorted(songDict.keys())
        # Get the first song hash
        firstSongOjbKey = listSorted[0]
        # Get the first song data
        songObj = songDict[firstSongOjbKey]
        
        if songObj['src'] != self.currentSong['src'] :
            # Play new song
            self.iniVLC(songObj)
        else :
            if songObj['track'] != self.currentSong['track'] :
                self.currentSong['track'] = songObj['track'] 
                self.player.audio_set_track(songObj['track'])
        
        return self.currentSong
    
    def iniVLC(self, sObj):
        self.currentSong = sObj
        
#         self.mediaListPlayer = vlc.MediaL
        
        # Init VLC
        self.player.stop()
#         self.player.set_media(self.instance.media_new('../../../' + self.currentSong['src']))
        path = os.path.join('../../../', self.currentSong['src'])
        
        o = '../../../musics/Vietnamese/Ai Lên Xứ Hoa Đào - Sơn Ca.VOB'
        u = o.encode('utf-8', 'strict')
        d = str(u) # Convert to String
        n = d.replace("b'", "'")  
        n = n.replace("'", '') 
        
        w = '../../../musics/Vietnamese/Ai L\xc3\xaan X\xe1\xbb\xa9 Hoa \xc4\x90\xc3\xa0o - S\xc6\xa1n Ca.VOB' # utf-8 bytes as a string
        print('w', type(w), w)
        
        l = '../../../musics/Vietnamese/Ai Lên Xứ Hoa Đào - Sơn Ca.VOB'
        print('l', type(l), l)
        
        print (w == n)
        
#         ../../../musics/Vietnamese/Ai L\xc3\xaan X\xe1\xbb\xa9 Hoa \xc4\x90\xc3\xa0o - S\xc6\xa1n Ca.VOB
#         self.player.set_media(self.instance.media_new('../../../musics/Vietnamese/Ai L\\\\xc3\\\\xaan X\\\\xe1\\\\xbb\\\\xa9 Hoa \\\\xc4\\\\x90\\\\xc3\\\\xa0o - S\\\\xc6\\\\xa1n Ca.VOB'))
        self.player.set_media(self.instance.media_new())
#         self.player.set_media(self.instance.media_new(ub))
        self.player.play()
        
#         if sys.platform == "linux2": # for Linux using the X Server
#             self.player.set_xwindow(guiContainer.winfo_id())
#         elif sys.platform == "win32": # for Windows
#             self.player.set_hwnd(guiContainer.winfo_id())
#         elif sys.platform == "darwin": # for MacOS
#             self.player.set_agl(guiContainer.winfo_id())
#         
    def onToggleTrackBtnClick(self):
        audioTrack = self.player.audio_get_track()
        trackNum = 1 if int(audioTrack) == 2 else 2
        self.player.audio_set_track(trackNum)
        print('onToggleTrackBtn click')
            
    def onNextClick(self, event):
        self.gui.destroy()
            
    def onEndReached(self, evt):
        print(evt)
            
    def onPlay(self, evt):
        print('onPlay')
        
    def onDeleteWindow(self):
        print('exit')
        self.gui.destroy()
        self.timer.cancel()
#         os.abort()
        sys.exit()
Example #18
0
def final_page(hint, time):

    root = Tk()
    root.title("A Compressed Software By Wang,Xu,Wu,Huang")
    root.geometry("999x666")
    root.resizable(width=True, height=True)
    root.eval('package require Tix')
    root['bg'] = '#FFFAF0'

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=480)

    text1 = Label(root,
                  text=hint,
                  bg="#FFFAF0",
                  fg="BLACK",
                  font=("黑体", 10),
                  width=100,
                  height=2,
                  anchor="center")
    text1.place(x=100, y=300)

    text2 = Label(root,
                  text="程序运行时间:",
                  bg="#FFFAF0",
                  fg="BLACK",
                  font=("黑体", 10),
                  width=100,
                  height=2,
                  anchor="center")
    text2.place(x=100, y=380)

    text3 = Label(root,
                  text=time,
                  bg="#FFFAF0",
                  fg="BLACK",
                  font=("黑体", 10),
                  width=100,
                  height=2,
                  anchor="center")
    text3.place(x=300, y=380)

    text4 = Label(root,
                  text="s",
                  bg="#FFFAF0",
                  fg="BLACK",
                  font=("黑体", 10),
                  width=3,
                  height=2,
                  anchor="center")
    text4.place(x=730, y=380)

    button1_3 = Button(root,
                       text="Return",
                       font=("宋体", 15),
                       command=lambda: location_page(root),
                       width=5,
                       height=1,
                       bg="#48D1CC")
    button1_3.place(x=780, y=600)

    button1_4 = Button(root,
                       text="Exit",
                       font=("宋体", 15),
                       command=lambda: sys.exit(),
                       width=5,
                       height=1,
                       bg="#20B2AA")
    button1_4.place(x=860, y=600)

    root.mainloop()
Example #19
0
def function_page(root_main_or_ocation):
    global Function_choice
    Function_choice = 0

    root_main_or_ocation.destroy()

    root = Tk()
    root.title("A Compressed Software By Wang,Xu,Wu,Huang")
    root.geometry("999x666")
    root.resizable(width=True, height=True)
    root.eval('package require Tix')
    root['bg'] = '#FFFAF0'
    text1 = Label(root,
                  text="-⭐-Compress Or Uncompress-⭐-",
                  bg="#FFFAF0",
                  fg="BLACK",
                  font=("黑体", 25),
                  width=50,
                  height=2,
                  anchor="center")
    text1.place(x=70, y=40)
    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=480)

    button1_1 = Button(root,
                       text="Compress",
                       font=("宋体", 30),
                       command=lambda: function(1, root),
                       width=15,
                       height=2,
                       bg="#87CEEB")
    button1_1.place(x=150, y=300)

    button1_2 = Button(root,
                       text="Uncompress",
                       font=("宋体", 30),
                       command=lambda: function(2, root),
                       width=15,
                       height=2,
                       bg="#4682B4")
    button1_2.place(x=550, y=300)

    button1_3 = Button(root,
                       text="Return",
                       font=("宋体", 15),
                       command=lambda: main_page(root),
                       width=5,
                       height=1,
                       bg="#48D1CC")
    button1_3.place(x=780, y=600)

    button1_4 = Button(root,
                       text="Exit",
                       font=("宋体", 15),
                       command=lambda: sys.exit(),
                       width=5,
                       height=1,
                       bg="#20B2AA")
    button1_4.place(x=860, y=600)

    root.mainloop()
Example #20
0
b1 = Button(tk,
            text="Start",
            command=tk.destroy,
            fg='Navy',
            font=("Georgia", 16, "bold"))
b1.place(x=1030, y=500, width=70, height=40)
b1["bg"] = "SpringGreen"

b2 = Button(tk,
            text="Quit",
            command=destroy,
            fg='RoyalBlue',
            font=("Georgia", 16, "bold"))
b2.place(x=1030, y=600, width=70, height=40)
b2["bg"] = "Navy"
tk.mainloop()

pygame.init()
# create the GAME screen
screen = pygame.display.set_mode((1370, 700))
pygame.display.set_caption('супермаркет "АТБ"')

# mixer.music.load("ozhidanijai.mp3")
# mixer.music.play(-1)

# ATB
width = 1365
height = 700
floor = pygame.image.load('img/floor.png')
floorImg = pygame.transform.scale(floor, (width, height))
Example #21
0
def location_page(root_function_or_final):
    global File_location
    File_location = "null"

    root_function_or_final.destroy()

    root = Tk()
    root.title("A Compressed Software By Wang,Xu,Wu,Huang")
    root.geometry("999x666")
    root.resizable(width=True, height=True)
    root.eval('package require Tix')
    root['bg'] = '#FFFAF0'
    text1 = Label(
        root,
        text="-⭐-Input The Location Of File You Want To Deal With-⭐-",
        bg="#FFFAF0",
        fg="BLACK",
        font=("黑体", 20),
        width=70,
        height=2,
        anchor="center")
    text1.place(x=10, y=40)
    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=200)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#D8BFD8",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=70, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#DDA0DD",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=282, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#BA55D3",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=494, y=480)

    imige1 = Label(root,
                   text="-⭐--⭐--⭐--⭐-",
                   bg="#8B008B",
                   fg="#FFFAF0",
                   font=("宋体", 8),
                   width=34,
                   height=1,
                   anchor="center")
    imige1.place(x=706, y=480)

    location_input = StringVar()
    location_input = Entry(root, bg="#ADD8E6", width=100)
    location_input.place(x=100, y=330)

    button1_3 = Button(root,
                       text="Start",
                       font=("宋体", 10),
                       command=lambda: get_location(root, location_input),
                       width=5,
                       height=1,
                       bg="#AFEEEE")
    button1_3.place(x=866, y=330)

    button1_3 = Button(root,
                       text="Return",
                       font=("宋体", 15),
                       command=lambda: function_page(root),
                       width=5,
                       height=1,
                       bg="#48D1CC")
    button1_3.place(x=780, y=600)

    button1_4 = Button(root,
                       text="Exit",
                       font=("宋体", 15),
                       command=lambda: sys.exit(),
                       width=5,
                       height=1,
                       bg="#20B2AA")
    button1_4.place(x=860, y=600)

    root.mainloop()
Example #22
0
                    height=total_height)

    render_april_board(canvas, options.num_x, options.num_y, options.tag_size,
                       options.tag_interval, Tag36h11(), 2 * tag_border_lt_x,
                       2 * tag_border_lt_y)
    if not options.axis_len == 0:
        render_axis(canvas, tag_border_lt_x, tag_border_lt_y,
                    options.axis_len)

    canvas.pack()

    file_name = f'output/Tag36h11_{options.num_y}_{options.num_x}'
    ps_file_name = f'{file_name}.eps'
    png_file_name = f'{file_name}.png'

    # Note:
    #   1. Must call `update()` before `postscript()`
    #   2. Canvas operation must before `Tk.mainloop()`
    #   3. Default postscript will scale canvas to (0.7496, 0.7496)
    #      To avoid this, set `pagewidth` and `pageheight`
    canvas.update()
    canvas.postscript(file=ps_file_name, pagewidth=total_width,
                      pageheight=total_height)

    img = Image.open(ps_file_name)  # use PIL to convert to PNG
    # print('img.size={}'.format(img.size))
    # foo = img.resize((total_width, total_height), Image.ANTIALIAS)
    img.save(png_file_name, 'png')

    tk_instance.mainloop()
Example #23
0
frame8 = Frame(root)
frame8.pack()
agree = StringVar()
agree = Checkbutton(
    frame8,
    text='我同意',
    variable=agree,
    onvalue='确定',
    offvalue="不确定",
)
agree.grid()

frame10 = Frame(root)
frame10.pack()
group = LabelFrame(frame10, text='特别鸣谢', padx=5, pady=5)
group.grid()
w = Label(group, text='容器框')
w.pack()

button = Button(root,
                text='QUIT',
                command=root.quit,
                activeforeground="black",
                activebackground='blue',
                bg='red',
                fg='white')
button.pack(fill=Y, expand=1)

root.mainloop()
Example #24
0
class CanvasDemo:
    def __init__(self):
        self.root = Tk()
        self.root.title("海王秘籍")
        self.canvas = Canvas(self.root, width=440, height=200, bg="White")
        self.canvas.pack()
        self.time_start = time.time()  #起始时间
        self.label = Label(text="")  #时间文本对象
        self.a = 0
        self.tetle = '''----------------------------------
wow钓鱼脚本v5.0(通用版)
说明:9键钓鱼,8开蚌壳,0键上鱼饵(请设置好宏),每钓鱼10分钟,自动上鱼饵
-----------------------------------
'''
        self.text_start = "3秒钟后开始钓鱼"
        self.text_start = self.tetle + self.text_start

        self.frame = Frame(self.root)
        self.frame.pack()
        self.btString = Button(self.frame, text="开 始", command=self.start)
        self.btClear = Button(self.frame, text="结 束", command=self.over)
        self.btString.grid(row=1, column=1)
        self.btClear.grid(row=1, column=2)
        self.label.pack()

        # self.p = Process(target=dy_run.dyrun)   #打开进程
        # self.str1 = ('python dy_run.py')    #测试环境
        self.str1 = ('dy_run.exe')  #exe环境

    def start(self):
        self.time_start = time.time()  #起始时间
        self.canvas.delete("rect", "oval", "arc", "polygon", "line", "string")

        self.canvas.create_text(220,
                                50,
                                text=self.text_start,
                                font="Tine 10 bold",
                                tags="string")
        self.a = 1
        self.p = subprocess.Popen(self.str1, shell=True)  #进程启动

        return self.a, self.p

    #结束按钮
    def over(self):
        self.canvas.delete("rect", "oval", "arc", "polygon", "line", "string")
        self.label.configure(text="运行了00时00分00秒")  #初始界面显示的文本
        self.tetle_over = self.tetle + self.over_time()
        self.canvas.create_text(220,
                                50,
                                text=self.tetle_over,
                                font="Tine 10 bold",
                                tags="string")
        self.a = 0
        self.time_start = time.time()
        # self.p.kill()  # 终止子进程            //windows下不好使
        os.system('taskkill /t /f /pid {}'.format(self.p.pid))  ##shell命令 结束进程

        return self.a, self.time_start

    #计算用时
    def over_time(self):
        time_new = time.time()
        timestamp = time_new - self.time_start
        m, s = divmod(timestamp, 60)
        h, m = divmod(m, 60)
        over_time = "程序一共运行了%02d时%02d分%02d秒" % (h, m, s)
        return over_time

    def update_clock(self):
        time_new = time.time()
        timestamp = time_new - self.time_start
        m, s = divmod(timestamp, 60)
        h, m = divmod(m, 60)
        shijian = "运行了%02d时%02d分%02d秒" % (h, m, s)

        if self.a == 1:
            self.label.configure(text=shijian)
        self.root.after(50, self.update_clock)

    def run(self):
        self.update_clock()
        self.canvas.create_text(220,
                                50,
                                text=self.tetle,
                                font="Tine 10 bold",
                                tags="string")
        self.root.mainloop()