示例#1
0
 def type_search(self):
     label = Label(self,
                   text='Расширенный поиск ',
                   font=('Arial Bold', 25),
                   bg="#b2bfbb")
     label.place(x=230, y=10)
     self.geometry('900x600')
     self.title('Поиск по критериям')
     label_choice = Label(self,
                          text='Выберите тип поиска: ',
                          font=('Arial', 17),
                          bg="#b2bfbb")
     label_choice.place(x=20, y=65)
     global var
     var = IntVar()
     rad1 = Radiobutton(self,
                        text='Поиск по одному критерию',
                        value=1,
                        variable=var,
                        command=self.selected_search)
     rad2 = Radiobutton(self,
                        text='Поиск по нескольким критериям',
                        value=2,
                        variable=var,
                        command=self.selected_search)
     rad1.place(x=20, y=115)
     rad2.place(x=20, y=140)
示例#2
0
文件: gui.py 项目: Potriashka/tdgeGUI
def new_object():
    icn = Label(tab2, text="Name of the object", font=("Arial Bold", 10))
    icn.place(x=8, y=20)

    size = Label(tab2, text="Size", font=("Arial Bold", 10))
    size.place(x=43, y=70)

    aw = Label(tab2, text="a", font=("Arial Bold", 10))
    aw.place(x=29, y=110)

    global a
    a = Entry(tab2, width=3)
    a.place(x=25, y=95)

    bw = Label(tab2, text="b", font=("Arial Bold", 10))
    bw.place(x=59, y=110)

    global b
    b = Entry(tab2, width=3)
    b.place(x=55, y=95)

    cw = Label(tab2, text="c", font=("Arial Bold", 10))
    cw.place(x=89, y=110)

    global c
    c = Entry(tab2, width=3)
    c.place(x=85, y=95)

    nameOO = Entry(tab2, width=15)
    nameOO.place(x=18, y=45)

    typeCUBE = Radiobutton(tab1, text='Color bg', value=1, command=typechuz)
    typeCUBE.place(x=20, y=200)
示例#3
0
    def __init__(self, parent: Tk or Toplevel, param_ids: List[int]):
        Frame.__init__(self, parent)
        self.parent = parent
        self.param_ids = param_ids
        self.paragraph_params = [
            param_id for param_id in param_ids if not PARAMS[param_id].is_run
        ]
        self.run_params = [
            param_id for param_id in param_ids if PARAMS[param_id].is_run
        ]

        self.pack(fill=BOTH, expand=1)
        self.centerWindow()

        self.parent.title('Введите параметры для анализа')
        self.addButton = Button(self,
                                text="Начать анализ",
                                command=self.new_test)
        self.addButton.place(x=247, y=360)
        self.user_input = {
            param_id: StringVar()
            for param_id in self.param_ids
        }

        indent = 0
        for param_id in self.param_ids:
            param = PARAMS[param_id]
            lbl = Label(self, text=param.name)
            lbl.place(x=10, y=10 + indent)
            scnd_row_x = 270
            if param.is_boolean:
                radio_btn = Radiobutton(self,
                                        variable=self.user_input[param_id],
                                        value="Нет")
                radio_btn.place(x=scnd_row_x, y=10 + indent)

                lbl_yes = Label(self, text="Нет")
                lbl_yes.place(x=scnd_row_x + 20, y=10 + indent)

                radio_btn = Radiobutton(self,
                                        variable=self.user_input[param_id],
                                        value="Да")
                radio_btn.place(x=scnd_row_x + 50, y=10 + indent)

                lbl_yes = Label(self, text="Да")

                lbl_yes.place(x=scnd_row_x + 70, y=10 + indent)
                self.user_input[param_id].set("Нет")

            else:
                text_field = Combobox(self,
                                      textvariable=self.user_input[param_id])
                text_field['values'] = param.default_vals
                text_field.current(param.start_val)
                text_field.place(x=scnd_row_x, y=10 + indent)

            indent += 23
示例#4
0
class App_test(object):
    def __init__(self, master, fuc, query, next, pre):
        self.win = master
        self.win.title('笔趣阁阅读_v1.0   by: 孤月')
        self.win.iconbitmap('./ico/gui_text_proce.ico')  # 指定界面图标
        curWidth = self.win.winfo_width()
        curHeight = self.win.winfo_height()
        scnWidth, scnHeight = self.win.maxsize()
        tmpcnf = '1340x640+500+300'  # % ((scnWidth - curWidth) / 2, (scnHeight - curHeight) / 2)
        self.win.geometry(tmpcnf)
        self.creat_res()
        self.set_position()
        self.add_train_info()
        self.res_config(fuc, query, next, pre)
        self.train_message = {}
        self.gettime()  # 系统时间

    def creat_res(self):
        self.v = IntVar()  # 书籍查询
        self.v.set(True)
        self.temp = StringVar()  # 书名/作者 录入
        self.temp2 = StringVar()  # 章节名录入
        self.sys_time = StringVar()  # 系统时间

        self.E_startstation = Entry(self.win, textvariable=self.temp)
        self.E_endstation = Entry(self.win, textvariable=self.temp2)

        self.La_startstation = Label(self.win, text="根据书名/作者搜索:")
        self.La_endstation = Label(self.win, text="根据章节名搜索:")
        self.La_directory = Label(self.win, text="目录")
        self.La_text = Label(self.win, text="正文")
        self.La_sys_time = Label(self.win, textvariable=self.sys_time, fg='blue', font=("黑体", 20))  # 设置字体大小颜色

        self.B_search = Button(self.win, text="搜索")
        self.B_buy_tick = Button(self.win, text="阅读")
        self.B_pre_chapter = Button(self.win, text="上一章")
        self.B_next_chapter = Button(self.win, text="下一章")

        self.R_site = Radiobutton(self.win, text="书名查询", variable=self.v, value=True)
        self.R_price = Radiobutton(self.win, text="章节查询", variable=self.v, value=False)

        self.init_data_Text = Text(self.win)  # 原始数据录入框
        self.S_move = Scrollbar(self.win)  # 目录滚动条
        self.S_text_move = Scrollbar(self.win)  # 创建文本框滚动条

    # 设置位置
    def set_position(self):
        self.init_data_Text.place(x=430, y=40, width=870, height=550)
        self.E_startstation.place(x=10, y=50, width=145, height=30)
        self.E_startstation.insert(10, "星辰变")
        self.E_endstation.place(x=10, y=140, width=145, height=30)
        self.E_endstation.insert(10, "第一章 秦羽")
        self.La_startstation.place(x=10, y=10, width=130, height=30)
        self.La_endstation.place(x=10, y=100, width=120, height=30)
        self.La_sys_time.place(x=1150, y=600, width=160, height=30)
        self.B_search.place(x=10, y=220, width=80, height=40)
        self.B_pre_chapter.place(x=950, y=600, width=80, height=40)
        self.B_next_chapter.place(x=1050, y=600, width=80, height=40)
        self.S_move.place(x=380, y=40, width=30, height=550)
        self.S_text_move.place(x=1300, y=40, width=30, height=550)
        self.B_buy_tick.place(x=90, y=220, width=80, height=40)
        self.R_site.place(x=10, y=180, width=90, height=30)
        self.R_price.place(x=100, y=180, width=90, height=30)
        self.La_directory.place(x=180, y=7, width=90, height=30)
        self.La_text.place(x=420, y=7, width=70, height=30)

    # 为按钮绑定事件
    def res_config(self, fuc, query, next_, pre):
        self.B_search.config(command=fuc)  # 搜索
        self.B_buy_tick.config(command=query)  # 阅读
        self.B_pre_chapter.config(command=pre)  # 上一章
        self.B_next_chapter.config(command=next_)  # 下一章
        self.S_move.config(command=self.tree.yview)  # 目录滚动条
        self.tree.config(yscrollcommand=self.S_move.set)
        self.S_text_move.config(command=self.init_data_Text.yview)  # 文本框滚动条
        self.init_data_Text.config(yscrollcommand=self.S_text_move.set)

    def add_train_info(self):
        lis_train = ["C" + str(x) for x in range(0, 2)]
        tuple_train = tuple(lis_train)
        self.tree = Treeview(self.win, columns=tuple_train, height=30, show="headings")
        self.tree.place(x=200, y=40, width=180, height=550)
        train_info = [' 书名 ', ' 作者 ']
        for i in range(0, len(lis_train)):
            self.tree.column(lis_train[i], width=len(train_info[i]) * 11,
                             anchor='w')  # must be n, ne, e, se, s, sw, w, nw, or center
            self.tree.heading(lis_train[i], text=train_info[i])

    # 实时显示时钟
    def gettime(self):
        # 获取当前时间
        self.sys_time.set(time.strftime("%H:%M:%S"))
        # 每隔一秒调用函数自身获取时间
        self.win.after(1000, self.gettime)
示例#5
0
class Movie_app:
    def __init__(self):
        self.win=Tk()
        self.win.title(" VIP视频破解工具")
        self.creat_res()
        self.creat_radiores()
        self.config()
        self.page=1
        self.p=Pro()
        self.win.resizable(0,0) #防止用户调整尺寸
        curWidth = 600
        curHight = 520
        # 获取屏幕宽度和高度
        scn_w, scn_h = self.win.maxsize()
        # 计算中心坐标
        cen_x = (scn_w - curWidth) / 2
        cen_y = (scn_h - curHight) / 2
        # 设置窗口初始大小和位置
        size_xy = '%dx%d+%d+%d' % (curWidth, curHight, cen_x, cen_y)
        self.win.geometry(size_xy)
        self.win.mainloop()


    def creat_res(self):
        #Menu菜单
        menu = tk.Menu(self.win)
        self.win.config(menu = menu)
        moviemenu = tk.Menu(menu,tearoff = 0)
        menu.add_cascade(label = '友情链接', menu = moviemenu)
        downmenu = tk.Menu(menu,tearoff = 0)
        #各个网站链接
        moviemenu.add_command(label = '网易公开课',command = lambda :webbrowser.open('http://open.163.com/'))
        moviemenu.add_command(label = '腾讯视频',command = lambda :webbrowser.open('http://v.qq.com/'))
        moviemenu.add_command(label = '搜狐视频',command = lambda :webbrowser.open('http://tv.sohu.com/'))
        moviemenu.add_command(label = '芒果TV',command = lambda :webbrowser.open('http://www.mgtv.com/'))
        moviemenu.add_command(label = '爱奇艺',command = lambda :webbrowser.open('http://www.iqiyi.com/'))
        moviemenu.add_command(label = 'PPTV',command = lambda :webbrowser.open('http://www.bilibili.com/'))
        moviemenu.add_command(label = '优酷',command = lambda :webbrowser.open('http://www.youku.com/'))
        moviemenu.add_command(label = '乐视',command = lambda :webbrowser.open('http://www.le.com/'))
        moviemenu.add_command(label = '土豆',command = lambda :webbrowser.open('http://www.tudou.com/'))
        moviemenu.add_command(label = 'A站',command = lambda :webbrowser.open('http://www.acfun.tv/'))
        moviemenu.add_command(label = 'B站',command = lambda :webbrowser.open('http://www.bilibili.com/'))

        self.temp=StringVar()#url地址
        self.temp2=StringVar()
        self.search=StringVar()#搜索
        self.t1=StringVar()#通道
        self.t3=StringVar()#爱奇艺,优酷,PPTV
        self.La_title=Label(self.win,text="第三方视频地址:")
        self.La_way=Label(self.win,text="选择视频解码通道:")
        self.La_mc=Label(self.win,text="关键字搜索:")
        #控件内容设置
        self.numberChosen = Combobox(self.win,width=20)
        self.numberChosen['values']=('通道一','通道二','通道三','通道四','通道五','通道六','通道七','通道八','通道九','通道十')
        self.numberChosen.config(state='readonly')
        self.numberChosen.current(0)

        self.B_play=Button(self.win,text="播放▶")
        self.B_searchSimple=Button(self.win,text="关键字搜索")
        self.B_uppage=Button(self.win,text="上页")
        self.B_nextpage=Button(self.win,text="下页")
        self.B_search=Button(self.win,text="搜索全站")
        self.La_page=Label(self.win,bg="#BFEFFF")
        self.S_croll=Scrollbar(self.win)
        self.L_box=Listbox(self.win,bg="#BFEFFF",selectmode=SINGLE)
        self.E_address=Entry(self.win,textvariable=self.temp)
        self.E_search=Entry(self.win,textvariable=self.search)
        self.label_explain = Label(self.win, fg = 'red', font = ('楷体',12), text = '\n注意:支持大部分主流视频网站的视频播放!\n此软件仅用于交流学习,请勿用于任何商业用途!\n在上面输入框输入现在主流视频网站网页地址\n点击播放弹出浏览器可以解码播放')
        self.label_explain.place(x=10,y=90,width=360,height=90)
        self.La_title.place(x=1,y=50,width=90,height=30)
        self.E_address.place(x=100,y=50,width=200,height=30)
        self.B_play.place(x=310,y=50,width=60,height=30)
        self.La_way.place(x=10,y=10,width=100,height=30)
        self.numberChosen.place(x=120,y=10,width=180,height=30)
        self.E_search.place(x=90,y=200,width=160,height=30)
        self.B_searchSimple.place(x=280,y=200,width=80,height=30)
        self.La_mc.place(x=10,y=200,width=70,height=30)
        self.B_search.place(x=252,y=240,width=100,height=30)
        self.L_box.place(x=10,y=280,width=252,height=230)
        self.S_croll.place(x=260,y=280,width=20,height=230)
        self.B_uppage.place(x=10,y=240,width=50,height=30)
        self.B_nextpage.place(x=180,y=240,width=50,height=30)
        self.La_page.place(x=80,y=240,width=90,height=28)

    def creat_radiores(self):
        self.movie=StringVar()#电影
        self.S_croll2=Scrollbar()#分集
        self.La_pic=Label(self.win,bg="#E6E6FA")
        self.La_movie_message=Listbox(self.win,bg="#7EC0EE")
        self.R_movie=Radiobutton(self.win,text="电影",variable=self.movie,value="m")
        self.tv=Radiobutton(self.win,text="电视剧",variable=self.movie,value="t")
        self.zhongyi=Radiobutton(self.win,text="综艺",variable=self.movie,value="z")
        self.dongman=Radiobutton(self.win,text="动漫",variable=self.movie,value="d")
        self.jilupian=Radiobutton(self.win,text="排行榜",variable=self.movie,value="j")
        self.movie.set('m')
        self.B_view=Button(self.win,text="查看")
        self.B_info=Button(self.win,text="使用说明")
        self.B_clearbox=Button(self.win,text="清空列表")
        self.B_add=Button(self.win,text="打开浏览器观看")
        self.R_movie.place(x=290,y=280,width=80,height=30)
        self.B_view.place(x=290,y=430,width=70,height=30)
        self.B_add.place(x=370,y=255,width=100,height=30)
        self.B_clearbox.place(x=500,y=255,width=70,height=30)
        self.tv.place(x=290,y=310,width=80,height=30)
        self.zhongyi.place(x=290,y=340,width=80,height=30)
        self.dongman.place(x=290,y=370,width=80,height=30)
        self.jilupian.place(x=290,y=400,width=80,height=30)
        self.La_movie_message.place(x=370,y=290,width=200,height=220)
        self.La_pic.place(x=370,y=10,width=200,height=240)
        self.B_info.place(x=290,y=470,width=70,height=30)
        self.S_croll2.place(x=568,y=290,width=20,height=220)

    def show_info(self):
        msg="""
        1.输入视频播放地址,即可播放
          下拉选择可切换视频源
        2.选择视频网,选择电视剧或者电影,
          搜索全网后选择想要看得影片,点
          查看,在右方list里选择分集视频
          添加到播放列表里点选播放
        3.复制网上视频连接
          点击播放即可(VIP视频也可以免费播放)
        4.此软件仅用于交流学习
          请勿用于任何商业用途!
        5.此软件内容来源于互联网
          此软件不承担任何由于内容的合法性及
          健康性所引起的争议和法律责任。
        6.欢迎大家对此软件内容侵犯版权等
          不合法和不健康行为进行监督和举报
        """
        messagebox.showinfo(title="使用说明",message=msg)

    def config(self):
        self.t1.set(True)
        self.B_play.config(command=self.play_url_movie)
        self.B_search.config(command=self.search_full_movie)
        self.B_info.config(command=self.show_info)
        self.S_croll.config(command=self.L_box.yview)
        self.L_box['yscrollcommand']=self.S_croll.set
        self.S_croll2.config(command=self.La_movie_message.yview)
        self.La_movie_message['yscrollcommand']=self.S_croll2.set
        self.B_view.config(command=self.view_movies)
        self.B_add.config(command=self.add_play_list)
        self.B_clearbox.config(command=self.clear_lisbox2)
        self.B_uppage.config(command=self.uppage_)
        self.B_nextpage.config(command=self.nextpage_)
        self.B_searchSimple.config(command=self.searchSimple)

    def uppage_(self):
        print('---------上一页---------')
        self.page-=1
        print(self.page)
        if self.page<1:
            self.page=1
        self.search_full_movie()
    def nextpage_(self):
        print('----------下一页--------')
        self.page+=1
        print(self.page)
        self.search_full_movie()

    def clear_lisbox(self):
        self.L_box.delete(0,END)

    def clear_lisbox2(self):
        self.La_movie_message.delete(0,END)

    def search_full_movie(self):
        print("-----search----")
        self.La_page.config(text="当前页:{}".format(self.page))
        self.clear_lisbox()
        try:
            movie_url, movie_title, movie_src_pic=self.p.get_movie_res(self.t3.get(),self.movie.get(),self.page)
            self.movie_dic={}
            for i,j,k in zip(movie_title,movie_url,movie_src_pic):
                self.movie_dic[i]=[j,k]
            for title in movie_title:
                self.L_box.insert(END,title)
            print(self.movie_dic)
            return self.movie_dic
        except:
            messagebox.showerror(title='警告',message='请选择电影或者电视剧')

    def add_play_list(self):
        print('---------playlist----------')
        # print(self.movie_dic)
        if self.La_movie_message.get(self.La_movie_message.curselection())=="":
            messagebox.showwarning(title="警告",message='请在列表选择影片')
        else:
            print("电影名字:",self.La_movie_message.get(self.La_movie_message.curselection()))
            # self.temp.set('http://www.133kp.com' + self.new_more_dic[self.La_movie_message.get(self.La_movie_message.curselection())])
            webbrowser.open('http://www.133kp.com' + self.new_more_dic[self.La_movie_message.get(self.La_movie_message.curselection())])


    def view_pic(self,pic_url):
        print('--------viewpic---------')
        pa_url_check=r'//.+[.]jpg'
        if re.match(pa_url_check,pic_url):
            print("ok")
            pic_url="http:"+pic_url
        print(pic_url)
        data=requests.get(pic_url).content
        # data=urlopen(pic_url).read()
        io_data=io.BytesIO(data)
        self.img=Image.open(io_data)
        self.u=ImageTk.PhotoImage(self.img)
        self.La_pic.config(image=self.u)

    def view_movies(self):
        print("--------viewmovie----------")
        self.clear_lisbox2()
        cur_index=self.L_box.curselection()
        print(self.L_box.get(cur_index))
        self.new_more_dic=self.p.get_more_tv_urls(self.movie_dic[self.L_box.get(cur_index)][0],self.t3.get(),self.movie.get())
        print(self.new_more_dic)
        for i,fenji_url in self.new_more_dic.items():
            self.La_movie_message.insert(END, i)
        self.view_pic(self.movie_dic[self.L_box.get(self.L_box.curselection())][1])#加载图片

    def play_url_movie(self):
        print("--------ok-----------")
        # print(type(self.t1.get()),self.t1.get())
        if self.temp.get()=="":
            messagebox.showwarning(title="警告",message="请先输入视频地址")
        else:
            if self.numberChosen.get()!="":
                self.p.play_movie(self.temp.get(),self.numberChosen.get())
            else:
                messagebox.showwarning(title='警告',message='请选择通道')
    def searchSimple(self):
        if self.search.get()=="":
            messagebox.showwarning(title="警告",message="请先输入搜索关键字")
        else:    
            self.clear_lisbox()  
            url = 'https://www.133kp.com//index.php?m=vod-search&wd={}'.format(self.search.get())
            res=requests.get(url=url,headers=self.p.header).content.decode('utf-8')
            html=etree.HTML(res)
            movie_size=html.xpath('//input[@class="pagego"]/@size')
            list = [] 
            for s in range(0, int(movie_size[0])):
                url = 'https://www.133kp.com/vod-search-pg-{}-wd-{}.html'.format(s+1,self.search.get())
                list.append(self.p.simpleSearch(url)) 
            # movie_url, movie_title, movie_src_pic=self.p.simpleSearch(self.search.get())
            self.movie_dic={}
            i = 0
            for b in list:
                for i,j,k in zip(b[0],b[1],b[2]):
                    self.movie_dic[i]=[j,re.findall(r'[(](.*?)[)]', k)[0]]
                for title in b[0]:
                    self.L_box.insert(END,title)
            print(self.movie_dic)
示例#6
0
class Movie_app:
    def __init__(self):
        self.win = Tk()
        self.win.geometry('600x420')
        self.win.title(" VIP视频破解工具")
        self.creat_res()
        self.creat_radiores()
        self.config()
        self.page = 1
        self.p = Pro()
        self.win.mainloop()

    def creat_res(self):
        #Menu菜单
        menu = tk.Menu(self.win)
        self.win.config(menu=menu)
        moviemenu = tk.Menu(menu, tearoff=0)
        menu.add_cascade(label='友情链接', menu=moviemenu)
        downmenu = tk.Menu(menu, tearoff=0)
        #各个网站链接
        moviemenu.add_command(
            label='网易公开课',
            command=lambda: webbrowser.open('http://open.163.com/'))
        moviemenu.add_command(
            label='腾讯视频', command=lambda: webbrowser.open('http://v.qq.com/'))
        moviemenu.add_command(
            label='搜狐视频',
            command=lambda: webbrowser.open('http://tv.sohu.com/'))
        moviemenu.add_command(
            label='芒果TV',
            command=lambda: webbrowser.open('http://www.mgtv.com/'))
        moviemenu.add_command(
            label='爱奇艺',
            command=lambda: webbrowser.open('http://www.iqiyi.com/'))
        moviemenu.add_command(
            label='PPTV',
            command=lambda: webbrowser.open('http://www.bilibili.com/'))
        moviemenu.add_command(
            label='优酷',
            command=lambda: webbrowser.open('http://www.youku.com/'))
        moviemenu.add_command(
            label='乐视', command=lambda: webbrowser.open('http://www.le.com/'))
        moviemenu.add_command(
            label='土豆',
            command=lambda: webbrowser.open('http://www.tudou.com/'))
        moviemenu.add_command(
            label='A站',
            command=lambda: webbrowser.open('http://www.acfun.tv/'))
        moviemenu.add_command(
            label='B站',
            command=lambda: webbrowser.open('http://www.bilibili.com/'))

        self.temp = StringVar()  #url地址
        self.temp2 = StringVar()
        self.t1 = StringVar()  #通道
        self.t3 = StringVar()  #爱奇艺,优酷,PPTV
        self.La_title = Label(self.win, text="地址:")
        self.La_way = Label(self.win, text="选择视频通道:")
        # self.R_way1=Radiobutton(self.win,text="通道A",variable=self.t1,value=True)
        # self.R_way2=Radiobutton(self.win,text="通道B",variable=self.t1,value=False)
        #控件内容设置
        self.numberChosen = Combobox(self.win, width=20)
        self.numberChosen['values'] = ('通道一', '通道二', '通道三', '通道四', '通道五',
                                       '通道六', '通道七', '通道八', '通道九', '通道十')
        self.numberChosen.config(state='readonly')
        self.numberChosen.current(1)

        self.R_aiqiyi = Radiobutton(self.win,
                                    text="爱奇艺",
                                    variable=self.t3,
                                    value="a")
        self.R_youku = Radiobutton(self.win,
                                   text="优酷",
                                   variable=self.t3,
                                   value="y")
        self.R_pptv = Radiobutton(self.win,
                                  text="PPTV",
                                  variable=self.t3,
                                  value="p")
        self.t3.set('y')
        self.B_play = Button(self.win, text="播放▶")
        self.B_uppage = Button(self.win, text="上页")
        self.B_nextpage = Button(self.win, text="下页")
        self.B_search = Button(self.win, text="搜索全站")
        # self.La_mesasge=Label(self.win,text="☜  ⇠☸⇢  ☞",bg="pink")
        self.La_page = Label(self.win, bg="#BFEFFF")
        self.S_croll = Scrollbar(self.win)
        self.L_box = Listbox(self.win, bg="#BFEFFF", selectmode=SINGLE)
        self.E_address = Entry(self.win, textvariable=self.temp)
        self.La_title.place(x=10, y=50, width=50, height=30)
        self.E_address.place(x=70, y=50, width=200, height=30)
        self.B_play.place(x=280, y=50, width=80, height=80)
        # self.R_way1.place(x=160,y=10,width=70,height=30)
        # self.R_way2.place(x=240,y=10,width=70,height=30)
        self.numberChosen.place(x=120, y=10, width=180, height=30)
        self.La_way.place(x=10, y=10, width=100, height=30)
        # self.R_aiqiyi.place(x=20,y=100,width=70,height=30)
        self.R_youku.place(x=20, y=100, width=70, height=30)
        self.R_pptv.place(x=90, y=100, width=70, height=30)
        self.B_search.place(x=252, y=140, width=100, height=30)
        # self.La_mesasge.place(x=80,y=125,width=90,height=20)
        self.L_box.place(x=10, y=180, width=252, height=230)
        self.S_croll.place(x=260, y=180, width=20, height=230)
        self.B_uppage.place(x=10, y=140, width=50, height=30)
        self.B_nextpage.place(x=180, y=140, width=50, height=30)
        self.La_page.place(x=80, y=140, width=90, height=28)

    def creat_radiores(self):
        self.movie = StringVar()  #电影
        self.S_croll2 = Scrollbar()  #分集
        self.La_pic = Label(self.win, bg="#E6E6FA")
        self.La_movie_message = Listbox(self.win, bg="#7EC0EE")
        self.R_movie = Radiobutton(self.win,
                                   text="电影",
                                   variable=self.movie,
                                   value="m")
        self.tv = Radiobutton(self.win,
                              text="电视剧",
                              variable=self.movie,
                              value="t")
        self.zhongyi = Radiobutton(self.win,
                                   text="综艺",
                                   variable=self.movie,
                                   value="z")
        self.dongman = Radiobutton(self.win,
                                   text="动漫",
                                   variable=self.movie,
                                   value="d")
        self.jilupian = Radiobutton(self.win,
                                    text="纪录片",
                                    variable=self.movie,
                                    value="j")
        self.movie.set('m')
        self.B_view = Button(self.win, text="查看")
        self.B_info = Button(self.win, text="使用说明")
        self.B_clearbox = Button(self.win, text="清空列表")
        self.B_add = Button(self.win, text="添加到播放列表")
        self.R_movie.place(x=290, y=180, width=80, height=30)
        self.B_view.place(x=290, y=330, width=70, height=30)
        self.B_add.place(x=370, y=255, width=100, height=30)
        self.B_clearbox.place(x=500, y=255, width=70, height=30)
        self.tv.place(x=290, y=210, width=80, height=30)
        self.zhongyi.place(x=290, y=240, width=80, height=30)
        self.dongman.place(x=290, y=270, width=80, height=30)
        self.jilupian.place(x=290, y=300, width=80, height=30)
        self.La_movie_message.place(x=370, y=290, width=200, height=120)
        self.La_pic.place(x=370, y=10, width=200, height=240)
        self.B_info.place(x=290, y=370, width=70, height=30)
        self.S_croll2.place(x=568, y=290, width=20, height=120)

    def show_info(self):
        msg = """
        1.输入视频播放地址,即可播放
          下拉选择可切换视频源
        2.选择视频网,选择电视剧或者电影,
          搜索全网后选择想要看得影片,点
          查看,在右方list里选择分集视频
          添加到播放列表里点选播放
        3.复制网上视频连接,点击播放即可
        4.VIP视频也可以免费播放
        """
        messagebox.showinfo(title="使用说明", message=msg)

    def config(self):
        self.t1.set(True)
        self.B_play.config(command=self.play_url_movie)
        self.B_search.config(command=self.search_full_movie)
        self.B_info.config(command=self.show_info)
        self.S_croll.config(command=self.L_box.yview)
        self.L_box['yscrollcommand'] = self.S_croll.set
        self.S_croll2.config(command=self.La_movie_message.yview)
        self.La_movie_message['yscrollcommand'] = self.S_croll2.set
        self.B_view.config(command=self.view_movies)
        self.B_add.config(command=self.add_play_list)
        self.B_clearbox.config(command=self.clear_lisbox2)
        self.B_uppage.config(command=self.uppage_)
        self.B_nextpage.config(command=self.nextpage_)

    def uppage_(self):
        print('---------上一页---------')
        self.page -= 1
        print(self.page)
        if self.page < 1:
            self.page = 1

    def nextpage_(self):
        print('----------下一页--------')
        self.page += 1
        print(self.page)
        if self.t3 == "a" or self.t3 == "y":
            if self.page > 30:
                self.page = 30
        elif self.t3 == "p":
            if self.movie == "m":
                if self.page > 165:
                    self.page = 165
            elif self.movie == "t":
                if self.page > 85:
                    self.page = 85
            elif self.movie == "z":
                if self.page > 38:
                    self.page = 38
            elif self.movie == "d":
                if self.page > 146:
                    self.page = 146
            elif self.movie == "j":
                if self.page > 40:
                    self.page = 40

    def clear_lisbox(self):
        self.L_box.delete(0, END)

    def clear_lisbox2(self):
        self.La_movie_message.delete(0, END)

    def search_full_movie(self):
        print("-----search----")
        self.La_page.config(text="当前页:{}".format(self.page))
        self.clear_lisbox()
        try:
            movie_url, movie_title, movie_src_pic = self.p.get_movie_res(
                self.t3.get(), self.movie.get(), self.page)
            self.movie_dic = {}
            for i, j, k in zip(movie_title, movie_url, movie_src_pic):
                self.movie_dic[i] = [j, k]
            for title in movie_title:
                self.L_box.insert(END, title)
            print(self.movie_dic)
            return self.movie_dic
        except:
            messagebox.showerror(title='警告', message='请选择电影或者电视剧')

    def add_play_list(self):
        print('---------playlist----------')
        print(self.movie_dic)
        if self.La_movie_message.get(
                self.La_movie_message.curselection()) == "":
            messagebox.showwarning(title="警告", message='请在列表选择影片')
        else:
            print(
                "电影名字:",
                self.La_movie_message.get(
                    self.La_movie_message.curselection()))
            if self.movie.get() != "m":
                self.temp.set(self.new_more_dic[self.La_movie_message.get(
                    self.La_movie_message.curselection())])
            else:
                self.temp.set(self.movie_dic[self.La_movie_message.get(
                    self.La_movie_message.curselection())][0])

    def view_pic(self, pic_url):
        print('--------viewpic---------')
        pa_url_check = r'//.+[.]jpg'
        if re.match(pa_url_check, pic_url):
            print("ok")
            pic_url = "http:" + pic_url
        print(pic_url)
        data = requests.get(pic_url).content
        # data=urlopen(pic_url).read()
        io_data = io.BytesIO(data)
        self.img = Image.open(io_data)
        self.u = ImageTk.PhotoImage(self.img)
        self.La_pic.config(image=self.u)

    def view_movies(self):
        print("--------viewmovie----------")
        self.clear_lisbox2()
        cur_index = self.L_box.curselection()
        print(self.L_box.get(cur_index))
        if self.movie.get() != "m":  #非电影类
            self.new_more_dic = self.p.get_more_tv_urls(
                self.movie_dic[self.L_box.get(cur_index)][0], self.t3.get(),
                self.movie.get())
            print(self.new_more_dic)
            for i, fenji_url in self.new_more_dic.items():
                self.La_movie_message.insert(END, i)
        else:  #电影类
            self.La_movie_message.insert(END, self.L_box.get(cur_index))
        self.view_pic(self.movie_dic[self.L_box.get(
            self.L_box.curselection())][1])  #加载图片

    def play_url_movie(self):
        print("--------ok-----------")
        # print(type(self.t1.get()),self.t1.get())
        if self.temp.get() == "":
            messagebox.showwarning(title="警告", message="请先输入视频地址")
        else:
            if self.numberChosen.get() != "":
                self.p.play_movie(self.temp.get(), self.numberChosen.get())
            else:
                messagebox.showwarning(title='警告', message='请选择通道')
示例#7
0
def triangle_GO():
    """ Функция, реагирующая на нажатие кнопки выбора фигуры(Треугольника) и запускающая необходимые запросы для расчёта. """

    # Обновление правой части калькулятора (ничего лучше не сработало).
    right_label_frame = LabelFrame(window, text='Брутальный калькулятор', width=600, height=500)
    right_label_frame.place(x=320, y=10)

    # Первый запрос (выбор способа расчёта).
    first_question_triangle = Label(right_label_frame, text="1) Выберите каким способом будет получен расчёт:")
    first_question_triangle.place(x=20, y=30)

    def conclusion():
        """ Вывод расчёта пользователю когда тот введёт необходимые данные. """
        data_output = Label(right_label_frame, text="3) Получен результат:")
        data_output.place(x=20, y=300)

    # Вывод трёх переключателей для выбора пользователем, от которых зависит метод расчёта.
    selected = IntVar()
    rad1 = Radiobutton(right_label_frame, text='Известна сторона (Значение_1) и высота (Значение_2)', value=1, variable=selected)
    rad2 = Radiobutton(right_label_frame, text='Известны две стороны (Значение_1, Значение_2) и угол между ними (Значение_3 (в градусах))', value=2, variable=selected)
    rad3 = Radiobutton(right_label_frame, text='Известны три стороны (Значение_1, Значение_2, Значение_3)', value=3, variable=selected)
    rad1.place(x=25, y=60)
    rad2.place(x=25, y=90)
    rad3.place(x=25, y=120)

    def data_request():
        """ Функция вывода второго вопроса с запросом известной величины и самой калькуляцией. """

        # Вывод полей для заполнения известными величинами.
        message_01, message_02, message_03 = DoubleVar(), DoubleVar(), DoubleVar()
        entry_01 = Entry(right_label_frame, width=10, textvariable=message_01)
        entry_01.place(x=95, y=233)
        entry_02 = Entry(right_label_frame, width=10, textvariable=message_02)
        entry_02.place(x=245, y=233)
        entry_03 = Entry(right_label_frame, width=10, textvariable=message_03)
        entry_03.place(x=395, y=233)
        entry_01_description = Label(right_label_frame, text="Значение_1:")
        entry_01_description.place(x=20, y=233)
        entry_02_description = Label(right_label_frame, text="Значение_2:")
        entry_02_description.place(x=170, y=233)
        entry_03_description = Label(right_label_frame, text="Значение_3:")
        entry_03_description.place(x=320, y=233)

        # Запрет вывода поля для Значения_3 в случае выбора 1-го способа расчёта.
        if selected.get() == 1:
            entry_03.place_forget()
            entry_03_description.place_forget()

        def calculation_for():
            """ Калькуляция(расчёт площади треугольника по формулам). """

            if selected.get() == 1:
                # Расчёт площади треугольника по стороне и высоте.
                a = message_01.get()
                h = message_02.get()
                S = 0.5 * (a * h)
                # Вывод расчёта пользователю с округлением.
                conclusion()
                data_output_conclusion = Label(right_label_frame, text=round(S, 2), font=("Arial Bold", 50))
                data_output_conclusion.place(x=20, y=350)
            elif selected.get() == 2:
                # Расчёт площади треугольника через две стороны и угол между ними.
                a = message_01.get()
                b = message_02.get()
                sin_a = int(message_03.get())
                # Конвертирую градусы в радианы для определения синуса угла. С последующим расчётом площади.
                S = 0.5 * a * b * math.sin(math.radians(sin_a))
               # Вывод расчёта пользователю с округлением.
                conclusion()
                data_output_conclusion = Label(right_label_frame, text=round(S, 2), font=("Arial Bold", 50))
                data_output_conclusion.place(x=20, y=350)
            elif selected.get() == 3:
                # Расчёт площади треугольника по трём сторонам.
                a = message_01.get()
                b = message_02.get()
                c = message_03.get()
                p = (a + b + c) / 2
                S = math.sqrt(p * (p - a) * (p - b) * (p - c))
                # Вывод расчёта пользователю с округлением.
                conclusion()
                data_output_conclusion = Label(right_label_frame, text=round(S, 2), font=("Arial Bold", 50))
                data_output_conclusion.place(x=20, y=350)

        # Кнопка подтверждения ввода известных величин. Требование рассчитать при нажатии.
        btn_calculation = Button(right_label_frame, text="Рассчитать!", command=calculation_for)
        btn_calculation.place(x=500, y=230)

        # Вывод второго вопроса.
        second_question_triangle = Label(right_label_frame, text="2) Введите известную величину в появившемся окне и нажмите на кнопку рассчёта.")
        second_question_triangle.place(x=20, y=200)

    # Кнопка подтверждения выбора метода расчёта.
    button_right_menu1 = Button(right_label_frame, text="Выбрать!", command=data_request)
    button_right_menu1.place(x=25, y=150)
示例#8
0
lbl_current_A.place(x=90, y=5)

spinbox_angle = Spinbox(lbl_current, from_=0, to=360, width=5)
spinbox_angle.place(x=170, y=5)
spinbox_angle.delete(0, "end")
spinbox_angle.insert(0, 0)
lbl_angle = Label(lbl_current, text="Угол")
lbl_angle.place(x=260, y=5)

lbl_phase = LabelFrame(window, text="Выберите задействованные фазы")
lbl_phase.place(x=15, y=135, width=350, heigh=60)

sel_phase = IntVar()
sel_phase.set(103)
rad_A = Radiobutton(lbl_phase, text='A', value=113, variable=sel_phase)
rad_A.place(x=5, y=5)
rad_B = Radiobutton(lbl_phase, text='B', value=123, variable=sel_phase)
rad_B.place(x=45, y=5)
rad_C = Radiobutton(lbl_phase, text='C', value=133, variable=sel_phase)
rad_C.place(x=85, y=5)
rad_ABC = Radiobutton(lbl_phase, text='ABC', value=103, variable=sel_phase)
rad_ABC.place(x=125, y=5)

lbl_voltage = LabelFrame(window, text="Установите параметры напряжения")
lbl_voltage.place(x=15, y=200, width=350, heigh=60)

sel_voltage = IntVar()
sel_voltage.set(2)
rad_voltage_57V = Radiobutton(lbl_voltage,
                              text='57В',
                              value=1,
示例#9
0
window.title("3D Game Engine")
window.geometry('400x250')

tab_control = ttk.Notebook(window)

tab1 = ttk.Frame(tab_control)
tab2 = ttk.Frame(tab_control)

tab_control.add(tab1, text='Window')
tab_control.add(tab2, text='Objects')

name = Label(tab1, text="3D Game Engine", font=("Arial Bold", 30))
name.place(x=50, y=5)

color = Radiobutton(tab1, text='Color bg', value=1, command=color_bg)
color.place(x=20, y=165)

image = Radiobutton(tab1, text='Picture bg', value=2, command=image_bg)
image.place(x=20, y=185)

titletext = Label(tab1, text="Project title", font=("Arial Bold", 10))
titletext.place(x=18, y=50)

title = Entry(tab1, width=15)
title.place(x=10, y=75)

resizable_btn = Radiobutton(tab1,
                            text='Resizible',
                            value=3,
                            command=resizable3)
resizable_btn.place(x=160, y=60)
示例#10
0
def Choice():
    window = Tk()
    window.geometry('350x400')
    l1 = Label(window, text='View Option Contract for:', bg='#f2f1cc')
    l1.place(x=30, y=35, height=35, width=150)
    b1 = Button(
        window,
        text="NIFTY",
        font=('Arial Bold', 10),
    )
    b1.configure(command=lambda: IsSelected(b1['text']), bg='#e2d1d0')
    b1.place(x=180, y=35, height=35, width=100)
    b2 = Button(window, text="BANKNIFTY", font=('Arial Bold', 10))
    l2 = Label(window, text='View Option Contract for:', bg='#f2f1cc')
    l2.place(x=30, y=110, height=35, width=150)
    b2.configure(command=lambda: IsSelected(b2['text']), bg='#e2d1d0')
    b2.place(x=180, y=110, height=35, width=100)
    l3 = Label(window, text='Select Symbol', font=('Arial', 10), bg='#f2f1cc')
    l3.place(x=60, y=185, height=35, width=100)
    cb = Combobox(window)
    cb['values'] = [
        "AARTIIND",
        "ACC",
        "ADANIENT",
        "ADANIPORTS",
        "AMARAJABAT",
        "AMBUJACEM",
        "APOLLOHOSP",
        "APOLLOTYRE",
        "ASHOKLEY",
        "ASIANPAINT",
        "AUROPHARMA",
        "AXISBANK",
        "BAJAJ-AUTO",
        "BAJAJFINSV",
        "BAJFINANCE",
        "BALKRISIND",
        "BANDHANBNK",
        "BANKBARODA",
        "BATAINDIA",
        "BEL",
        "BERGEPAINT",
        "BHARATFORG",
        "BHARTIARTL",
        "BHEL",
        "BIOCON",
        "BOSCHLTD",
        "BPCL",
        "BRITANNIA",
        "CADILAHC",
        "CANBK",
        "CHOLAFIN",
        "CIPLA",
        "COALINDIA",
        "COFORGE",
        "COLPAL",
        "CONCOR",
        "CUMMINSIND",
        "DABUR",
        "DIVISLAB",
        "DLF",
        "DRREDDY",
        "EICHERMOT",
        "ESCORTS",
        "EXIDEIND",
        "FEDERALBNK",
        "FINNIFTY",
        "GAIL",
        "GLENMARK",
        "GMRINFRA",
        "GODREJCP",
        "GODREJPROP",
        "GRASIM",
        "HAVELLS",
        "HCLTECH",
        "HDFC",
        "HDFCAMC",
        "HDFCBANK",
        "HDFCLIFE",
        "HEROMOTOCO",
        "HINDALCO",
        "HINDPETRO",
        "HINDUNILVR",
        "IBULHSGFIN",
        "ICICIBANK",
        "ICICIGI",
        "ICICIPRULI",
        "IDEA",
        "IDFCFIRSTB",
        "IGL",
        "INDIGO",
        "INDUSINDBK",
        "INDUSTOWER",
        "INFRATEL",
        "INFY",
        "IOC",
        "ITC",
        "JINDALSTEL",
        "JSWSTEEL",
        "JUBLFOOD",
        "KOTAKBANK",
        "L&TFH",
        "LALPATHLAB",
        "LICHSGFIN",
        "LT",
        "LUPIN",
        "M&M",
        "M&MFIN",
        "MANAPPURAM",
        "MARICO",
        "MARUTI",
        "MCDOWELL-N",
        "MFSL",
        "MGL",
        "MINDTREE",
        "MOTHERSUMI",
        "MRF",
        "MUTHOOTFIN",
        "NATIONALUM",
        "NAUKRI",
        "NESTLEIND",
        "NMDC",
        "NTPC",
        "ONGC",
        "PAGEIND",
        "PEL",
        "PETRONET",
        "PFC",
        "PIDILITIND",
        "PNB",
        "POWERGRID",
        "PVR",
        "RAMCOCEM",
        "RBLBANK",
        "RECLTD",
        "RELIANCE",
        "SAIL",
        "SBILIFE",
        "SBIN",
        "SHREECEM",
        "SIEMENS",
        "SRF",
        "SRTRANSFIN",
        "SUNPHARMA",
        "SUNTV",
        "TATACHEM",
        "TATACONSUM",
        "TATAMOTORS",
        "TATAPOWER",
        "TATASTEEL",
        "TCS",
        "TECHM",
        "TITAN",
        "TORNTPHARM",
        "TORNTPOWER",
        "TVSMOTOR",
        "UBL",
        "ULTRACEMCO",
        "UPL",
        "VEDL",
        "ZEEL",
        "VOLTAS",
    ]
    cb.current(0)
    cb.place(x=160, y=185, height=35, width=100)
    l4 = Label(window,
               text="Refresh in (minutes):",
               font=('Arial', 10),
               bg="#f2f1cc")
    l4.place(x=25, y=260, height=40, width=130)
    rad1 = Radiobutton(window,
                       text='5',
                       value=1,
                       command=lambda: refereshPeriod(5))
    rad2 = Radiobutton(window,
                       text='15',
                       value=0,
                       command=lambda: refereshPeriod(15))
    rad3 = Radiobutton(window,
                       text='30',
                       value=3,
                       command=lambda: refereshPeriod(30))
    rad4 = Radiobutton(window,
                       text='60',
                       value=4,
                       command=lambda: refereshPeriod(60))
    rad1.place(x=160, y=260, height=40, width=30)
    rad2.place(x=200, y=260, height=40, width=35)
    rad3.place(x=240, y=260, height=40, width=35)
    rad4.place(x=280, y=260, height=40, width=35)
    l5 = Label(window,
               text="For non-commerical use only.",
               font=('Arial', 10),
               fg='red')
    l5.place(x=75, y=375, height=35, width=175)
    cb.bind("<<ComboboxSelected>>", lambda Combobox=cb: IsSelected(cb.get()))
    b3 = Button(window,
                text="View stocks selected.",
                font=('Arial', 10),
                bg='#e2d1d0',
                command=listbox)
    b3.place(x=100, y=325, height=35, width=150)
    window.title('Stock data updater')
    window.resizable(0, 0)
    window.protocol("WM_DELETE_WINDOW", lambda: closeWindow(window))
    window.mainloop()
示例#11
0
class Movie_app:
    def __init__(self):
        self.win = Tk()
        self.win.geometry('600x420')
        self.win.title("爱奇艺-优酷-PPTV视频播放下载器V3.1")
        self.creat_res()
        self.creat_radiores()
        self.config()
        self.page = 1
        self.p = Pro()
        self.win.mainloop()

    def creat_res(self):
        self.temp = StringVar()  # url地址
        self.temp2 = StringVar()
        self.t1 = StringVar()  # 通道
        self.t3 = StringVar()  # 爱奇艺,优酷,PPTV
        self.La_title = Label(self.win, text="地址:")
        self.La_way = Label(self.win, text="选择视频通道:")
        self.R_way1 = Radiobutton(self.win,
                                  text="通道A",
                                  variable=self.t1,
                                  value=True)
        self.R_way2 = Radiobutton(self.win,
                                  text="通道B",
                                  variable=self.t1,
                                  value=False)
        self.R_aiqiyi = Radiobutton(self.win,
                                    text="爱奇艺",
                                    variable=self.t3,
                                    value="a")
        self.R_youku = Radiobutton(self.win,
                                   text="优酷",
                                   variable=self.t3,
                                   value="y")
        self.R_pptv = Radiobutton(self.win,
                                  text="PPTV",
                                  variable=self.t3,
                                  value="p")
        self.B_play = Button(self.win, text="播放▶")
        self.B_uppage = Button(self.win, text="上页")
        self.B_nextpage = Button(self.win, text="下页")
        self.B_search = Button(self.win, text="♣搜索全站♠")
        self.La_mesasge = Label(self.win, text="☜  ⇠☸⇢  ☞", bg="pink")
        self.La_page = Label(self.win, bg="#BFEFFF")
        self.S_croll = Scrollbar(self.win)
        self.L_box = Listbox(self.win, bg="#BFEFFF", selectmode=SINGLE)
        self.E_address = Entry(self.win, textvariable=self.temp)
        self.La_title.place(x=10, y=50, width=50, height=30)
        self.E_address.place(x=70, y=50, width=200, height=30)
        self.B_play.place(x=300, y=50, width=50, height=30)
        self.R_way1.place(x=160, y=10, width=70, height=30)
        self.R_way2.place(x=240, y=10, width=70, height=30)
        self.La_way.place(x=10, y=10, width=100, height=30)
        self.R_aiqiyi.place(x=20, y=100, width=70, height=30)
        self.R_youku.place(x=90, y=100, width=70, height=30)
        self.R_pptv.place(x=160, y=100, width=70, height=30)
        self.B_search.place(x=252, y=140, width=100, height=30)
        self.La_mesasge.place(x=80, y=125, width=90, height=20)
        self.L_box.place(x=10, y=180, width=252, height=230)
        self.S_croll.place(x=260, y=180, width=20, height=230)
        self.B_uppage.place(x=10, y=140, width=50, height=30)
        self.B_nextpage.place(x=180, y=140, width=50, height=30)
        self.La_page.place(x=80, y=150, width=90, height=28)

    def creat_radiores(self):
        self.movie = StringVar()  # 电影
        self.S_croll2 = Scrollbar()  # 分集
        self.La_pic = Label(self.win, bg="#E6E6FA")
        self.La_movie_message = Listbox(self.win, bg="#7EC0EE")
        self.R_movie = Radiobutton(self.win,
                                   text="电影",
                                   variable=self.movie,
                                   value="m")
        self.tv = Radiobutton(self.win,
                              text="电视剧",
                              variable=self.movie,
                              value="t")
        self.zhongyi = Radiobutton(self.win,
                                   text="综艺",
                                   variable=self.movie,
                                   value="z")
        self.dongman = Radiobutton(self.win,
                                   text="动漫",
                                   variable=self.movie,
                                   value="d")
        self.jilupian = Radiobutton(self.win,
                                    text="纪录片",
                                    variable=self.movie,
                                    value="j")
        self.B_view = Button(self.win, text="✤查看✤")
        self.B_info = Button(self.win, text="使用说明")
        self.B_clearbox = Button(self.win, text="清空列表")
        self.B_add = Button(self.win, text="添加到播放列表")
        self.R_movie.place(x=290, y=180, width=80, height=30)
        self.B_view.place(x=290, y=330, width=70, height=30)
        self.B_add.place(x=370, y=255, width=100, height=30)
        self.B_clearbox.place(x=500, y=255, width=70, height=30)
        self.tv.place(x=290, y=210, width=80, height=30)
        self.zhongyi.place(x=290, y=240, width=80, height=30)
        self.dongman.place(x=290, y=270, width=80, height=30)
        self.jilupian.place(x=290, y=300, width=80, height=30)
        self.La_movie_message.place(x=370, y=290, width=200, height=120)
        self.La_pic.place(x=370, y=10, width=200, height=240)
        self.B_info.place(x=290, y=370, width=70, height=30)
        self.S_croll2.place(x=568, y=290, width=20, height=120)

    def show_info(self):
        msg = """
        1.输入视频播放地址,即可播放
          选择A或者B可切换视频源
        2.选择视频网,选择电视剧或者电影,
          搜索全网后选择想要看得影片,点
          查看,在右方list里选择分集视频
          添加到播放列表里点选播放
        """
        messagebox.showinfo(title="使用说明", message=msg)

    def config(self):
        self.t1.set(True)
        self.B_play.config(command=self.play_url_movie)
        self.B_search.config(command=self.search_full_movie)
        self.B_info.config(command=self.show_info)
        self.S_croll.config(command=self.L_box.yview)
        self.L_box['yscrollcommand'] = self.S_croll.set
        self.S_croll2.config(command=self.La_movie_message.yview)
        self.La_movie_message['yscrollcommand'] = self.S_croll2.set
        self.B_view.config(command=self.view_movies)
        self.B_add.config(command=self.add_play_list)
        self.B_clearbox.config(command=self.clear_lisbox2)
        self.B_uppage.config(command=self.uppage_)
        self.B_nextpage.config(command=self.nextpage_)

    def uppage_(self):
        print('---------上一页---------')
        self.page -= 1
        print(self.page)
        if self.page < 1:
            self.page = 1

    def nextpage_(self):
        print('----------下一页--------')
        self.page += 1
        print(self.page)
        if self.t3 == "a" or self.t3 == "y":
            if self.page > 30:
                self.page = 30
        elif self.t3 == "p":
            if self.movie == "m":
                if self.page > 165:
                    self.page = 165
            elif self.movie == "t":
                if self.page > 85:
                    self.page = 85
            elif self.movie == "z":
                if self.page > 38:
                    self.page = 38
            elif self.movie == "d":
                if self.page > 146:
                    self.page = 146
            elif self.movie == "j":
                if self.page > 40:
                    self.page = 40

    def clear_lisbox(self):
        self.L_box.delete(0, END)

    def clear_lisbox2(self):
        self.La_movie_message.delete(0, END)

    def search_full_movie(self):
        print("-----search----")
        self.La_page.config(text="当前页:{}".format(self.page))
        self.clear_lisbox()
        try:
            movie_url, movie_title, movie_src_pic = self.p.get_movie_res(
                self.t3.get(), self.movie.get(), self.page)
            self.movie_dic = {}
            for i, j, k in zip(movie_title, movie_url, movie_src_pic):
                self.movie_dic[i] = [j, k]
            for title in movie_title:
                self.L_box.insert(END, title)
            print(self.movie_dic)
            return self.movie_dic
        except:
            messagebox.showerror(title='警告', message='请选择电影或者电视剧')

    def add_play_list(self):
        print('---------playlist----------')
        print(self.movie_dic)
        if self.La_movie_message.get(
                self.La_movie_message.curselection()) == "":
            messagebox.showwarning(title="警告", message='请在列表选择影片')
        else:
            print(
                "电影名字:",
                self.La_movie_message.get(
                    self.La_movie_message.curselection()))
            if self.movie.get() != "m":
                self.temp.set(self.new_more_dic[self.La_movie_message.get(
                    self.La_movie_message.curselection())])
            else:
                self.temp.set(self.movie_dic[self.La_movie_message.get(
                    self.La_movie_message.curselection())][0])

    def view_pic(self, pic_url):
        print('--------viewpic---------')
        pa_url_check = r'//.+[.]jpg'
        if re.match(pa_url_check, pic_url):
            print("ok")
            pic_url = "http:" + pic_url
        print(pic_url)
        data = requests.get(pic_url).content
        # data=urlopen(pic_url).read()
        io_data = io.BytesIO(data)
        self.img = Image.open(io_data)
        self.u = ImageTk.PhotoImage(self.img)
        self.La_pic.config(image=self.u)

    def view_movies(self):
        print("--------viewmovie----------")
        cur_index = self.L_box.curselection()
        print(self.L_box.get(cur_index))
        if self.movie.get() != "m":  # 非电影类
            self.new_more_dic = self.p.get_more_tv_urls(
                self.movie_dic[self.L_box.get(cur_index)][0], self.t3.get(),
                self.movie.get())
            print(self.new_more_dic)
            for i, fenji_url in self.new_more_dic.items():
                self.La_movie_message.insert(END, i)
        else:  # 电影类
            self.La_movie_message.insert(END, self.L_box.get(cur_index))
        self.view_pic(self.movie_dic[self.L_box.get(
            self.L_box.curselection())][1])  # 加载图片

    def play_url_movie(self):
        print("--------ok-----------")
        # print(type(self.t1.get()),self.t1.get())
        if self.temp.get() == "":
            messagebox.showwarning(title="警告", message="请先输入视频地址")
        else:
            if self.t1.get() != "":
                self.p.play_movie(self.temp.get(), self.t1.get())
            else:
                messagebox.showwarning(title='警告', message='请选择通道')
示例#12
0
class App(object):
    def __init__(self):
        self.w = Tk()
        self.w.title('抖音下载器')
        self.w.geometry('400x320')
        # self.w.iconbitmap('res/image/logo.ico')
        self.creat_res()
        self.w.mainloop()

    def creat_res(self):
        self.temp = StringVar()
        self.num = StringVar()  # 截图数量
        self.water = StringVar()  # 是否水印
        self.pics = StringVar()  # 是否截图
        self.L_enter = Label(self.w, text='请输入抖音分享链接', fg='#32CD32')
        self.L_res = Label(self.w, text='信息', bg='#F0FFF0', fg="#B452CD")
        self.L_message = Label(self.w, text='', bg='#71C671')
        self.E_enter = Entry(self.w, textvariable=self.temp)
        self.B_go = Button(self.w, text='GO')
        self.L_box = Listbox(self.w)
        self.S_bal = Scrollbar(self.w, orient=VERTICAL, bg='red')
        self.S_x_bal = Scrollbar(self.w, orient=HORIZONTAL, bg='red')
        self.R_water1 = Radiobutton(self.w,
                                    text='有水印',
                                    variable=self.water,
                                    value='1')
        self.R_water2 = Radiobutton(self.w,
                                    text='无水印',
                                    variable=self.water,
                                    value='2')
        self.R_savepic1 = Radiobutton(self.w,
                                      text='截图张数',
                                      variable=self.pics,
                                      value='1')
        self.R_savepic2 = Radiobutton(self.w,
                                      text='不截图',
                                      variable=self.pics,
                                      value='2')
        self.E_num_pics = Entry(self.w, textvariable=self.num)
        self.res_place()
        self.res_config()

    def res_place(self):
        self.L_enter.place(x=10, y=10, width=150, height=30)
        self.E_enter.place(x=10, y=50, width=200, height=30)
        self.B_go.place(x=220, y=50, width=40, height=30)
        self.L_message.place(x=180, y=10, width=200, height=30)
        self.L_box.place(x=10, y=120, width=200, height=170)
        self.L_res.place(x=260, y=140, width=100, height=100)
        self.S_bal.place(x=210, y=120, width=15, height=170)
        self.R_water1.place(x=10, y=85, width=60, height=30)
        self.R_water2.place(x=100, y=85, width=60, height=30)
        self.R_savepic1.place(x=180, y=85, width=80, height=30)
        self.E_num_pics.place(x=260, y=88, width=30, height=25)
        self.R_savepic2.place(x=295, y=85, width=60, height=30)
        self.S_x_bal.place(x=10, y=280, width=200, height=15)

    def res_config(self):
        self.S_bal.config(command=self.L_box.yview)
        self.L_box["yscrollcommand"] = self.S_bal.set
        self.S_x_bal.config(command=self.L_box.xview)
        self.L_box["xscrollcommand"] = self.S_x_bal.set
        self.B_go.config(command=self.get_user_uid)
        self.water.set('2')  # 默认无水印
        self.pics.set('1')  # 默认截图
        self.num.set(1)

    def pics_num_set(self):
        if int(self.num.get()) > 5:
            messagebox.showwarning(title='提示', message='只允许截图5张')
        elif int(self.num.get()) < 1:
            messagebox.showwarning(title='提示', message='如果不需要,请选择不截图')

    def get_user_uid(self):
        self.pics_num_set()  # 设置截图数量
        self.clear_box()  # 清空box
        d = douyin()
        d.msg_lis.clear()  # 清空列表
        try:
            uid = get_uid(self.temp.get())
            print(uid)
            print(self.water.get())
            self.L_message.config(text='用户ID:{}'.format(uid))
            if uid:
                print(self.water.get(), type(self.water.get()))
                if self.water.get() == '1':  # 有水印
                    watermark = True
                elif self.water.get() == '2':  # 无水印
                    watermark = False
                print(uid, type(uid), watermark)
                self.get_uid_vdo(str(uid), watermark)
            elif uid == False:
                messagebox.showerror(title='错误', message='未解析出uid')
        except Exception:
            messagebox.showerror(title='友情提示', message='请输入分享链接')

    def clear_box(self):
        self.L_box.delete(0, END)

    def box_show(self, msg):
        self.L_box.insert(END, msg)

    def show_res(self):
        msg_video_water = ''
        msg_pics = ''
        if self.water.get() == '2':
            msg_video_water = '选择:无水印'
        elif self.water.get() == '1':
            msg_video_water = '选择:有水印'
        if self.pics.get() == '1':
            msg_pics = '每个视频截图{}张'.format(self.num.get())
        elif self.pics.get() == '2':
            msg_pics = '选择:无截图'
        print('提示', msg_video_water, msg_pics)
        msg = '当前信息:' + '\n' + msg_video_water + '\n' + msg_pics + '\n'
        self.L_res.config(text=msg)

    def get_uid_vdo(self, uid, watermark):
        print('test-ok')
        print('jietu', self.pics.get())
        d = douyin()
        while True:
            flag, nickname, name_list = d.run(uid, watermark)
            print(name_list)
            n = int(self.num.get())
            for i in name_list:
                self.down_pics(nickname, i, n)
            for m in d.msg_lis:
                self.box_show(m)
            if flag is True:
                self.L_message.config(text='视频已全部下载完')
                self.show_res()  # 显示爬虫结果
                break

    def down_pics(self, nickname, video_name, n):
        print('down')
        print(self.pics.get())
        if self.pics.get() == '1':  # 选择下载
            print('截图 ')
            cut_pic(nickname, video_name, n)  # 三个参数 用户名,视频文件名,数量
        elif self.pics.get() == '2':
            print('不截图')
示例#13
0
def crearElementos():
    root = tk.Tk()
    root.geometry("400x500")
    root.title("Titulo de la ventana")

    # Crear Label
    label = ttk.Label(root, text="Introduce un texto:", font=("Arial Bold", 20))
    # Posicionar la etiqueta
    label.place(x=50, y=20)

    # Crear caja de texto.
    entry = ttk.Entry(root)
    entry.place(x=50, y=60)

    # Crear Radio Button
    var = tk.IntVar()
    R1 = Radiobutton(root, text="Option 1", variable=var, value=1)
    R1.pack(anchor=tk.W)
    R1.place(x=50, y=100)

    R2 = Radiobutton(root, text="Option 2", variable=var, value=2)
    R2.pack(anchor=tk.W)
    R2.place(x=50, y=130)

    R3 = Radiobutton(root, text="Option 3", variable=var, value=3)
    R3.pack(anchor=tk.W)
    R3.place(x=50, y=160)

    # Crear CheckButton
    CheckVar1 = tk.IntVar()
    CheckVar2 = tk.IntVar()
    C1 = tk.Checkbutton(root, text="Check 1", variable=CheckVar1, onvalue=1, offvalue=0)
    C1.pack()
    C1.place(x=150, y=100)
    C2 = tk.Checkbutton(root, text="check 2", variable=CheckVar2, onvalue=1, offvalue=0)
    C2.pack()
    C2.place(x=150, y=130)

    # Crear ComboBox
    comboExample = ttk.Combobox(root,
                                values=[
                                    "Enero",
                                    "Febrero",
                                    "Marzo",
                                    "Abril"])
    print(dict(comboExample))
    comboExample.grid(column=0, row=1)
    comboExample.current(0)
    comboExample.place(x=50, y=200)
    print(comboExample.current(), comboExample.get())

    # Crear un Menu
    menubar = tk.Menu(root)
    root.config(menu=menubar)

    filemenu = tk.Menu(menubar, tearoff=0)
    filemenu.add_command(label="Nuevo")
    filemenu.add_command(label="Abrir")
    filemenu.add_command(label="Guardar")
    filemenu.add_command(label="Cerrar")
    filemenu.add_separator()
    filemenu.add_command(label="Salir", command=root.quit)

    editmenu = tk.Menu(menubar, tearoff=0)
    editmenu.add_command(label="Cortar")
    editmenu.add_command(label="Copiar")
    editmenu.add_command(label="Pegar")

    helpmenu = tk.Menu(menubar, tearoff=0)
    helpmenu.add_command(label="Ayuda")
    helpmenu.add_separator()
    helpmenu.add_command(label="Acerca de...")

    menubar.add_cascade(label="Archivo", menu=filemenu)
    menubar.add_cascade(label="Editar", menu=editmenu)
    menubar.add_cascade(label="Ayuda", menu=helpmenu)

    # Crear un Spinbox
    spinner = tk.Spinbox(root, from_=0, to=20)
    spinner.pack()
    spinner.place(x=50, y=230)

    def clicked():
        # Crear MessageBox
        messagebox.showinfo("Alerta", "El boton se ha ejecutado correctamente")
        textBox.insert(INSERT, "Texto: " + str(entry.get()) +
                       "\nSpinner: " + str(spinner.get()) +
                       "\nCombobox: " + str(comboExample.get()) +
                       "\n")

        # Crear un Dialog
        answer = messagebox.askokcancel("Cerar Mensaje", "Quieres cerrar la alerta?")

    # Crear un Boton
    btn = Button(root, text="NO pulses", command=clicked)
    btn.place(x=50, y=270)

    # Crear campo Text
    textBox = scrolledtext.ScrolledText(width=20, height=5)
    textBox.place(x=50, y=310)

    root.mainloop()  # Fin root
示例#14
0
class App_test(object):
    def __init__(self):
        self.win = Tk()
        self.win.title('12306火车票查询系统V2.6')
        self.win.geometry('860x400')
        self.creat_res()
        self.add_train_info()
        self.add_check_button()
        self.res_config()
        self.train_message = {}
        # self.get_train_args()
        self.win.mainloop()

    def creat_res(self):
        self.v = IntVar()  #车票查询
        self.v.set(True)
        self.temp = StringVar()  #开始站
        self.temp2 = StringVar()  #目的站
        self.start_mon = StringVar()  #出发月
        self.start_day = StringVar()  #出发日
        self.start_year = StringVar()  #出啊年
        self.E_startstation = Entry(self.win, textvariable=self.temp)
        self.E_endstation = Entry(self.win, textvariable=self.temp2)
        self.La_startstation = Label(self.win, text="出发站:")
        self.La_endstation = Label(self.win, text="目的站:")
        self.La_time = Label(self.win, text="请选择出发时间-年-月-日", fg="blue")
        self.B_search = Button(self.win, text="搜索")
        self.R_site = Radiobutton(self.win,
                                  text="车票查询",
                                  variable=self.v,
                                  value=True)
        self.R_price = Radiobutton(self.win,
                                   text="票价查询",
                                   variable=self.v,
                                   value=False)
        self.B_buy_tick = Button(self.win, text="购票")
        self.C_year = Combobox(self.win, textvariable=self.start_year)
        self.C_mon = Combobox(self.win, textvariable=self.start_mon)
        self.La_s = Label(self.win, text="--")
        self.C_day = Combobox(self.win, textvariable=self.start_day)
        self.S_move = Scrollbar(self.win)
        self.E_startstation.place(x=70, y=10, width=65, height=30)
        self.E_endstation.place(x=70, y=60, width=65, height=30)
        self.La_startstation.place(x=10, y=10, width=50, height=30)
        self.La_endstation.place(x=10, y=60, width=50, height=30)
        self.La_time.place(x=10, y=100, width=150, height=30)
        self.C_year.place(x=10, y=140, width=70, height=30)
        self.C_mon.place(x=100, y=140, width=50, height=30)
        self.C_day.place(x=100, y=180, width=50, height=30)
        self.La_s.place(x=80, y=140, width=20, height=30)
        self.B_search.place(x=10, y=180, width=50, height=30)
        self.S_move.place(x=834, y=40, width=30, height=350)
        self.B_buy_tick.place(x=10, y=260, width=80, height=40)
        self.R_site.place(x=10, y=230, width=70, height=30)
        self.R_price.place(x=90, y=230, width=70, height=30)

    def res_config(self):
        self.C_year.config(values=[x for x in range(2018, 2020)])
        self.C_mon.config(values=["{:02d}".format(x)
                                  for x in range(1, 13)])  #时间格式是2018-01-01
        self.C_day.config(values=["{:02d}".format(x) for x in range(1, 32)])
        self.B_search.config(command=self.search_train_message)
        self.S_move.config(command=self.tree.yview)
        self.tree.config(yscrollcommand=self.S_move.set)

    def add_train_info(self):
        lis_train = ["C" + str(x) for x in range(0, 15)]
        tuple_train = tuple(lis_train)
        self.tree = Treeview(self.win,
                             columns=tuple_train,
                             height=30,
                             show="headings")
        self.tree.place(x=168, y=40, width=670, height=350)
        train_info = [
            ' 车次 ', ' 出发/到达站', '出发/到达时间', '历时 ', '商/特座', '一等座', '二等座', '高软',
            '软卧', '动卧', '硬卧', '软座', '硬座', '无座', '其他'
        ]
        for i in range(0, len(lis_train)):
            self.tree.column(lis_train[i],
                             width=len(train_info[i]) * 11,
                             anchor='center')
            self.tree.heading(lis_train[i], text=train_info[i])

    def add_check_button(self):
        self.v1 = IntVar()
        self.v2 = IntVar()
        self.v3 = IntVar()
        self.v4 = IntVar()
        self.v5 = IntVar()
        self.v6 = IntVar()
        self.v7 = IntVar()
        self.v1.set("T")
        self.Check_total = Checkbutton(self.win,
                                       text="全部车次",
                                       variable=self.v1,
                                       onvalue='T')
        self.Check_total.place(x=168, y=7, width=80, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="G-高铁",
                                       variable=self.v2,
                                       onvalue='T')
        self.Check_total.place(x=258, y=7, width=70, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="D-动车",
                                       variable=self.v3,
                                       onvalue='T')
        self.Check_total.place(x=348, y=7, width=60, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="Z-直达",
                                       variable=self.v4,
                                       onvalue='T')
        self.Check_total.place(x=418, y=7, width=60, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="T-特快",
                                       variable=self.v5,
                                       onvalue='T')
        self.Check_total.place(x=488, y=7, width=60, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="K-快速",
                                       variable=self.v6,
                                       onvalue='T')
        self.Check_total.place(x=568, y=7, width=60, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="其他",
                                       variable=self.v7,
                                       onvalue='T')
        self.Check_total.place(x=648, y=7, width=60, height=30)

    def get_train_args(self):  #输出获得的日期,出发站代码,目的站代码
        date = self.start_year.get() + "-" + self.start_mon.get(
        ) + "-" + self.start_day.get()
        start_station = self.temp.get()
        end_station = self.temp2.get()
        start_station_str = ""
        end_station_str = ""
        count1, count2 = 0, 0
        with open("res/dict2.txt", mode='r', encoding='utf-8') as f:
            mes = f.readlines()
            for i in mes:
                d = json.loads(i)
                if start_station in d:
                    start_station_str = d[start_station]
                else:
                    count1 += 1
                if end_station in d:
                    end_station_str = d[end_station]
                else:
                    count2 += 1
            if count1 == len(mes) or count2 == len(mes):
                messagebox.showwarning(title="友情提示", message="无法找到车站数据")
        return date, start_station_str, end_station_str

    def is_leapyear(self):
        #先判断输入是否是日期,如果是日期执行方法体,
        a = self.C_year.get()
        b = self.C_mon.get()
        c = self.C_day.get()
        pa_year = '20[\d][\d]'  # 2018
        if re.compile(pa_year).findall(a) and b in [
                "{:02d}".format(x) for x in range(1, 13)
        ] and c in ["{:02d}".format(x) for x in range(1, 32)]:
            nowtime = time.localtime()
            now_time_sp = time.mktime(nowtime)
            start_time = a + "-" + b + "-" + c + " 23:59:29"  #"2018-08-09  23:59:29"
            start_timestrip = time.strptime(start_time, "%Y-%m-%d %H:%M:%S")
            start_times = time.mktime(start_timestrip)
            days = (start_times - now_time_sp) / 60 / 60 / 24
            print(days)
            print(a, b, c)
            if days > 29:
                messagebox.showerror(title="警告", message="大于30天无法获取数据")
            elif days < 0:
                messagebox.showerror(title="警告", message="小于1天无法获取数据")
            elif days > 0 and days < 30:
                if int(a) % 4 == 0 and int(a) % 100 != 0 or int(
                        a) % 400 == 0:  #如果是闰年
                    if (int(b) in (1, 3, 5, 7, 8, 10, 12) and int(c) > 31) or (
                        (int(b) in (4, 6, 9, 11)
                         and int(c) > 30)) or (int(b) == 2 and int(c) > 29):
                        messagebox.showerror(title="警告", message="你确定这个月有这一天么")
                else:
                    if (int(b) in (1, 3, 5, 8, 10, 12) and int(c) > 31) or (
                        (int(b) in (4, 6, 9, 11)
                         and int(c) > 30)) or (int(b) == 2 and int(c) > 28):
                        messagebox.showerror(title="警告", message="你确定这个月有这一天么")
        else:
            messagebox.showerror(title="警告", message="请输入正确格式的年:月:日")

    def manage_date(self):  #处理时间,闰年以及当天时间
        self.is_leapyear()

    def change_str(self, mm):
        for i, j in mm.items():
            with open("res/dict.txt", mode='r', encoding='utf-8') as f:
                mes = f.readlines()
                for s in mes:
                    d = json.loads(s)
                    if j[0] in d:
                        j[0] = d[j[0]]
                    if j[1] in d:
                        j[1] = d[j[1]]
        # print(self.new_train_message) #车次信息
        non_empty_str = ['']
        for m, n in mm.items():
            mm[m] = ['-' if x in non_empty_str else x for x in n]  # 替换''字符为'-'
        return mm

    def trans_train_dic(self):  #输出出发站-目的站-名字
        date, start_station, end_station = self.get_train_args()
        print(date, start_station, end_station)
        try:
            p = Pro_train(date, start_station, end_station)
            self.train_message = p.get_train_res()  # 获得车次信息字典 车次英文
            self.train_tick = p.get_tarin_ticket()  #获得票价信息
            # print(self.train_message) #车次信息
            self.new_train_message = self.train_message  #复制一份
            self.new_train_tick = self.train_tick
            self.new_train_message = self.change_str(self.new_train_message)
            self.new_train_tick = self.change_str(self.new_train_tick)
            return self.new_train_message, self.new_train_tick  # 中文字典
        except Exception as e:
            # messagebox.showerror(title="警告",message="无法解析数据,请重新选择")
            print("错误码:", e.args)

    def search_train_message(self):
        self.manage_date()  #处理日期-True-transe-view
        if self.v.get():
            self.view_list()
        else:
            self.view_price()

    def clear_tree(self):
        x = self.tree.get_children()
        for n in x:
            self.tree.delete(n)

    def view_list(self):  #显示到网格
        # 车次 出发/站 出发到达时间 历时 商务座31  一等座30 二等座29  高软20 软卧22 动卧 硬卧27 软座23 硬座28 无座25 其他21
        try:
            self.clear_tree()
            self.new_train_message, x = self.trans_train_dic()  #生成新车次字典
            for i, j in self.new_train_message.items():
                self.tree.insert("",
                                 "end",
                                 values=(i, j[0] + "->" + j[1],
                                         j[2] + "->" + j[3], j[4], j[5], j[6],
                                         j[7], j[8], j[9], j[10], j[11], j[12],
                                         j[13], j[14], j[15]))
        except Exception as e:
            # messagebox.showerror(title="警告",message="无法处理数据")
            print("错误:", e.args)

    def view_price(self):
        print("-------票价ok-------")
        try:
            self.clear_tree()
            y, self.new_train_tick = self.trans_train_dic()  #生成新车次字典
            for i, j in self.new_train_tick.items():
                self.tree.insert("",
                                 "end",
                                 values=(i, j[0] + "->" + j[1],
                                         j[2] + "->" + j[3], j[4], j[5], j[6],
                                         j[7], j[8], j[9], j[10], j[11], j[12],
                                         j[13], j[14], "-"))
        except Exception as e:
            # messagebox.showerror(title="警告",message="无法处理数据")
            print("错误:", e.args)
                   command=clicka)
radb = Radiobutton(windowdone,
                   text='Найти один из катетов (b)',
                   value=2,
                   command=clickb)
radc = Radiobutton(windowdone,
                   text='Найти гипотенузу (с)',
                   value=3,
                   command=clickc)

#Создание пунктов для ввода
entrya = Entry(windowdone, width=20)
entryb = Entry(windowdone, width=20)
entryc = Entry(windowdone, width=20)

#Размещение "радио"кнопок
rada.place(x=0, y=30)
radb.place(x=0, y=60)
radc.place(x=0, y=90)

#Размещение пунктов
entrya.place(x=250, y=30)
entryb.place(x=250, y=60)
entryc.place(x=250, y=90)

#Размещение кнопок
btnsol.place(x=120, y=120)
btncln.place(x=200, y=120)

windowdone.mainloop()
示例#16
0
    def helloUI(self):
        self.inputNameTextBox = Text(root_hello,
                                     width=11,
                                     height=1,
                                     font=("Times New Roman", 14),
                                     wrap="none")
        self.inputNameTextBox.place(x=170, y=30)

        self.lbl3 = Label(root_hello, text="Имя", font=("Times New Roman", 14))
        self.lbl3.place(x=130, y=30)

        self.lbl4 = Label(root_hello, text="Пол", font=("Times New Roman", 14))
        self.lbl4.place(x=130, y=70)

        self.lbl5 = Label(root_hello,
                          text="Цвет",
                          font=("Times New Roman", 14))
        self.lbl5.place(x=127, y=110)

        self.lbl6 = Label(root_hello,
                          text="Уровень сложности:",
                          font=("Times New Roman", 14))
        self.lbl6.place(x=130, y=150)

        combo = Combobox(root_hello, font=("Times New Roman", 12))
        combo1 = Combobox(root_hello, font=("Times New Roman", 12))
        combo['values'] = ("женщина", "мужчина")
        combo1['values'] = ("розовый", "голубой", "жёлтый")
        combo.current(1)
        combo1.current(1)
        combo.grid(column=0, row=0)
        combo1.grid(column=0, row=0)
        combo.place(x=170, y=72, width=100, height=25)
        combo1.place(x=170, y=112, width=100, height=25)

        chk = Radiobutton(root_hello, text='1', value=1)
        chk1 = Radiobutton(root_hello, text='2', value=2)
        chk2 = Radiobutton(root_hello, text='3', value=3)
        chk.grid(column=0, row=0)
        chk1.grid(column=1, row=0)
        chk2.grid(column=2, row=0)
        chk.place(x=130, y=180, width=30, height=30)
        chk1.place(x=200, y=180, width=30, height=30)
        chk2.place(x=270, y=180, width=30, height=30)

        def random_RGB():
            return rdm.randint(0, 255)

        def random_RGB_str():
            return str(random_RGB())

        colorTitle_Label = Label(root_hello,
                                 text="Цвет рук:",
                                 font=("Times New Roman", 14))
        colorTitle_Label.place(x=130, y=210)

        def create_RGB_input(title, x_location):
            y_location = 240
            label = Label(root_hello,
                          text=title + " =",
                          font=("Times New Roman", 14))
            label.place(x=x_location, y=y_location)

            text_box = Text(root_hello,
                            width=3,
                            height=1,
                            font=("Times New Roman", 14),
                            wrap="none")

            text_box.insert(INSERT, random_RGB_str())
            text_box.place(x=x_location + 40, y=y_location)
            return text_box

        def x_RGB_input_location(number):
            start_x = 130
            offset = 80
            return start_x + offset * number

        self.R_textBox = create_RGB_input('R', x_RGB_input_location(0))
        self.G_textBox = create_RGB_input('G', x_RGB_input_location(1))
        self.B_textBox = create_RGB_input('B', x_RGB_input_location(2))

        def startGame_click():
            def get_textbox_text(textbox):
                return textbox.get(1.0, END)

            def textbox_to_int(textbox):
                return int(get_textbox_text(textbox))

            def is_RGB(s):
                try:
                    chanel = int(s)
                    if 0 <= chanel <= 255:
                        return True
                    return False
                except ValueError:
                    return False

            def is_RGB_textbox(text_box):
                return is_RGB(get_textbox_text(text_box))

            input_text = get_textbox_text(self.inputNameTextBox).replace(
                '\n', '')
            if input_text == '':
                return

            if not is_RGB_textbox(self.R_textBox) or not is_RGB_textbox(
                    self.G_textBox) or not is_RGB_textbox(self.B_textBox):
                messagebox.showerror("Ошибка ввода",
                                     "Цвет введён не корректно!")
                return

            global replacement_color
            replacement_color = (textbox_to_int(self.R_textBox),
                                 textbox_to_int(self.G_textBox),
                                 textbox_to_int(self.B_textBox), 255)

            color = combo1.get()

            bg_hex = None

            if color == "розовый":
                bg_hex = "#ffc0cb"

            if color == "голубой":
                bg_hex = "#42aaff"

            if color == "жёлтый":
                bg_hex = "#ffff00"

            root_start["bg"] = bg_hex

            root_hello.withdraw()

            root_start.deiconify()

            app_start = Main(root_start, input_text, bg_hex)
            app_start.pack()
            app_start.mainloop()

        btn4 = Button(root_hello,
                      text="Поехали",
                      font=("Times New Roman", 15),
                      command=startGame_click)
        btn4.place(x=160, y=280, width=100, height=30)
示例#17
0
        Channel_Per_Cell=int(self.t7.get())
        Total_Channel_Capacity=(Total_Cell*Channel_Per_Cell)
        self.t8.insert(END, str(Total_Channel_Capacity))
    
    def possible_call(self,event):
        self.t9.delete(0, 'end')
        Total_Cell=int(self.t6.get())
        Channel_Per_Cell=int(self.t7.get())
        Total_Possible_Call=(Total_Cell*Channel_Per_Cell)
        self.t9.insert(END, str(Total_Possible_Call))
    

#Define window
 
window=Tk()
mywin=MyWindow(window)


v0=IntVar()
v0.set(1)
r1=Radiobutton(window, text="Microcell", variable=v0,value=1)
r2=Radiobutton(window, text="Macrocell", variable=v0,value=2)
r1.place(x=327,y=105)
r2.place(x=405, y=105)
                


window.title('Mobile and Wireless Communication project')
window.configure(background='#A3CEDC')
window.geometry("700x600+10+10")
window.mainloop()
示例#18
0
文件: gui.py 项目: Potriashka/tdgeGUI
window.title("3D Game Engine")
window.geometry('500x350')

tab_control = ttk.Notebook(window)

tab1 = ttk.Frame(tab_control)
tab2 = ttk.Frame(tab_control)

tab_control.add(tab1, text='Window')
tab_control.add(tab2, text='Objects')

name = Label(tab1, text="3D Game Engine", font=("Arial Bold", 30))
name.place(x=50, y=5)

color = Radiobutton(tab1, text='Color bg', value=1, command=color_bg)
color.place(x=20, y=200)

image = Radiobutton(tab1, text='Picture bg', value=2, command=image_bg)
image.place(x=20, y=220)

titletext = Label(tab1, text="Project title", font=("Arial Bold", 10))
titletext.place(x=22, y=62)

title = Entry(tab1, width=15)
title.place(x=10, y=85)

resizable_btn = Radiobutton(tab1,
                            text='Resizible',
                            value=3,
                            command=resizable3)
resizable_btn.place(x=20, y=260)
示例#19
0
class App(object):
    def __init__(self):
        self.win=Tk()
        self.win.geometry('405x380')
        self.win.title("网易云mp3播放下载器")
        self.creat_res()
        self.res_config()
        self.win.mainloop()

    def creat_res(self):
        self.music_temp=StringVar(value="(.)(.)")
        self.mp3_lis=[] #备用
        self.temp=StringVar()#url输入框
        self.temp2=IntVar() #单选框 播放或者下载
        self.temp3=StringVar()#path 输入框
        self.T_message=Listbox(self.win,background="#EEE9E9")
        self.B_search=Button(self.win,text="搜索")
        self.B_path=Button(self.win,text="选择目录")
        self.E_song=Entry(self.win,textvariable=self.temp)
        self.E_path=Entry(self.win,textvariable=self.temp3)
        self.Play_button=Button(self.win,text="播放")
        self.Pause_button=Button(self.win,textvariable=self.music_temp)
        self.Temp_button=Button(self.win,text="单曲下载")
        self.Stop_button=Button(self.win,text="停止")
        self.Info=Button(self.win,text="说明")
        self.More_down=Button(self.win,text="歌单批量下载")
        self.B_search_loacl=Button(self.win,text="扫描本地歌曲")
        self.S_bal=Scrollbar(self.win)
        self.R_1=Radiobutton(self.win,variable=self.temp2,text="下载",value=True)
        self.R_2=Radiobutton(self.win,variable=self.temp2,text="播放",value=False)
        self.L_mp3_message=Label(self.win,background="#EEE9E9",fg="#9370DB")
        self.B_search.place(x=340,y=5,width=50,height=30)
        self.E_song.place(x=10,y=10,width=300,height=35)
        self.T_message.place(x=10,y=165,width=280,height=200)
        self.Play_button.place(x=340,y=160,width=50,height=40)
        self.Pause_button.place(x=340,y=209,width=50,height=40)
        self.Temp_button.place(x=130,y=125,width=100,height=30)
        self.S_bal.place(x=286,y=165,width=20,height=200)
        self.E_path.place(x=10,y=70,width=200,height=40)
        self.B_path.place(x=230,y=75,width=60,height=38)
        self.L_mp3_message.place(x=241,y=125,width=152,height=30)
        self.Info.place(x=340,y=315,width=50,height=40)
        self.More_down.place(x=10,y=125,width=100,height=30)
        self.B_search_loacl.place(x=300,y=75,width=100,height=38)
        self.R_1.place(x=265,y=50,width=60,height=25)
        self.R_2.place(x=340,y=50,width=60,height=25)
        self.Stop_button.place(x=340,y=260,width=50,height=40)

    def res_config(self):
        self.B_search.config(command=self.get_lis)
        self.S_bal.config(command=self.T_message.yview)
        self.T_message["yscrollcommand"]=self.S_bal.set
        self.T_message.config(selectmode=BROWSE)
        self.B_path.config(command=self.choose_path)
        self.More_down.config(command=self.download_music)
        self.Info.config(command=self.show_mesage)
        self.Temp_button.config(command=self.single_music_down)
        self.Play_button.config(command=self.play_music)
        self.Pause_button.config(command=self.pause_button_click)
        self.Stop_button.config(command=self.stop_button_click)
        self.temp2.set(1) #默认配置为下载模式

    def choose_path(self):
        self.path_=askdirectory()
        self.temp3.set(self.path_)

    def show_mesage(self):
        msg="输入框可识别歌单list,或者歌曲名称 '\n'" \
            "输入歌单,请搜索后选择单独下载或者全部批量下载 '\n'" \
            "播放单曲需要先选择路径,选择歌曲"
        messagebox.showinfo(message=msg,title="使用说明")

    def get_web_lis(self):
        if self.temp.get()!="":#输入框非空
            flag = music_get.do_something(self.temp.get())
            music_dic=music_get.get_music_id(self.temp.get())
            if flag==True:#输入的是链接
                mp3_url=music_get.get_mps_url(self.temp.get())
                for i, j in mp3_url.items():#i是id号
                    self.T_message.insert(END,"歌曲:"+i+"\n")
            else:#如果输入的是单曲
                self.T_message.insert(END, "正在查找歌曲:" + self.temp.get() + "\n")
                for id,name in music_dic.items():
                    self.T_message.insert(END, "找到歌曲:{}-{}".format(id,name)+ "\n")
        else:
            self.T_message.insert(END, "清输入歌曲名或者歌单链接:"  + "\n")
            messagebox.showerror(title="警告",message="请输入歌名或者歌曲清单链接")

    def get_loacl_lis(self):
        for file in os.listdir(self.temp3.get()):
            self.T_message.insert(END, file + "\n")

    def get_lis(self):#搜索按钮,先判断下输入的是url 还是单曲
        print("开关",self.temp2.get())
        if self.temp2.get():#wen搜索
            print("web搜索")
            self.get_web_lis()
        else: #本地搜所
            print("本地搜索")
            self.get_loacl_lis()

    def download_music(self):#歌单批量下载
        try:
            mp3_url = music_get.get_mps_url(self.temp.get())#mp3 清单表 字典
            print(mp3_url)
            music_get.down_mp3(self.temp3.get(),self.temp.get())
            flag = music_get.do_something(self.temp.get())
            print(self.temp.get(),self.temp3.get())
            if os.path.exists(self.temp3.get()) and flag==True and len(mp3_url)>0:#路径存在,输入连接,dic飞空
                self.L_mp3_message.config(text="批量下载中,请不要再操作软件")
                for i in mp3_url.keys():
                    t=random.randint(100,300)*0.01
                    self.T_message.insert(END, "正在努力下载歌曲:" + i + "\n")
                    time.sleep(t)
            else:
                self.T_message.insert(END, "请输入歌单连接和存储路径" + "\n")
        except Exception as s:
            print(s.args)
            self.T_message.insert(END, "请先输入歌单连接和存储路径" + "\n")
            messagebox.showerror(title="警告",message="请输入歌名或者歌曲清单链接")


    def get_id(self):#获取id号
        if self.T_message.curselection():#不为空
            s=self.T_message.curselection()
            res=self.T_message.get(s[0])
            pa_id='找到歌曲:[\d]+-.+'
            if re.match(pa_id,res):#选择listbox
                id=res[res.find(":")+1:res.find("-")]
                return id
            else:
                self.T_message.insert(END, "请选择带id号的歌曲" + "\n")
        else:
            self.T_message.insert(END, "请先搜索歌名" + "\n")

    def single_music_down(self):#单曲下载
        print("----------下载单曲----------")
        id=self.get_id()
        flag=music_get.do_something(self.temp.get())#判断是url 还是歌曲名字 如果是url true 否则f
        if os.path.exists(self.temp3.get()) and flag==False:
            try:
                music_get.down_music2(self.temp3.get(),id,self.temp.get())
                self.T_message.insert(END, "正在下载歌曲:" +self.temp.get()+ str(id) + "\n")
                self.L_mp3_message.config(text="歌曲{}_{}下载完成".format(self.temp.get(),id))
            except Exception:
                self.T_message.insert(END, "请选择带的ID号的歌曲:" + "\n")
                messagebox.showwarning(title="友情提示", message="请选择带的ID号的歌曲")
        else:
            self.T_message.insert(END, "erro,请选择存储路径:" + "\n")
            messagebox.showwarning(title="温馨提示",message="请先搜索歌曲再选择存储路径")


    def play_music(self):
        print("播放音乐")
        path=self.temp3.get()#路径
        if os.path.exists(path) and self.temp2.get()==False:#如果路径存在,开关在播放模式
            if self.T_message.curselection():#lisbox飞空
                print("--------开始播放--------")
                music_file=self.T_message.get(self.T_message.curselection())
                current_music_path=self.temp3.get()+"/"+music_file
                pa_music=".+[\.]mp3"
                if re.match(pa_music,music_file):#匹配mp3文件
                    print("文件识别OK")
                    print(current_music_path)
                    self.L_mp3_message.config(text="文件识别OK")
                    self.play_music_mp3(current_music_path.strip()) #此处有坑,需要清除字符串换行符
                    self.music_temp.set("暂停")
                else:
                    print("非mp3文件")
                    self.L_mp3_message.config(text="非mp3文件")
            else:
                self.T_message.insert(END, "erro,请选择歌名:" + "\n")
        else:
            messagebox.showwarning(title="温馨提示",message="请选择歌曲路径,选择播放模式")

    def play_music_mp3(self,name):#播放音乐
        pygame.init()
        pygame.mixer.music.load(name)
        pygame.mixer.music.play()
        time.sleep(12)
        # pygame.mixer.music.stop()

    def pause_button_click(self):
        if self.music_temp.get()=="暂停":
            pygame.mixer.music.pause()
            self.music_temp.set("继续")
        elif self.music_temp.get()=="继续":
            pygame.mixer.music.unpause()
            self.music_temp.set("暂停")

    def pause_music(self):
        print("暂停播放")
        pygame.mixer.music.pause()

    def stop_button_click(self):
        pygame.mixer.music.stop()
示例#20
0
class App:
    def __init__(self):
        self.w = Tk()
        self.w.geometry('320x340')
        self.w.title('python库下载器V2.1')
        self.creat_res()
        self.res_config()  # 配置文件
        self.pp = Pip_downs()
        self.w.mainloop()

    def creat_res(self):  # 创建控件
        self.temp = StringVar()  # 输入框
        self.path_file = StringVar()  # 存储路径
        self.sorce = StringVar()  # 选择源
        self.B_search = Button(self.w, text='查找')
        self.B_file = Button(self.w, text='选择存储目录')
        self.B_down = Button(self.w, text='下载')
        self.B_add = Button(self.w, text='添加')
        self.L_search = Label(self.w, text='选择源:', bg='#B2DFEE')
        self.E_input = Entry(self.w, textvariable=self.temp)
        self.E_path = Entry(self.w, textvariable=self.path_file)
        self.L_pack = Label(self.w, text='找到:', bg='#B2DFEE')
        self.L_packs = Label(self.w, text='找到:', bg='#B2DFEE')
        self.L_box = Listbox(self.w, selectmode=SINGLE)
        self.L_box_se = Listbox(self.w, selectmode=SINGLE)
        self.S_col_y_1 = Scrollbar(self.w, orient=VERTICAL)  # 左边Y
        self.S_col_x_1 = Scrollbar(self.w, orient=HORIZONTAL)  # 左边X
        self.S_col_y_2 = Scrollbar(self.w, orient=VERTICAL)  # 右边Y
        self.S_col_x_2 = Scrollbar(self.w, orient=HORIZONTAL)  # 右边X
        self.L_message = Label(self.w, text='', bg='#C6E2FF')
        self.creat_radios()
        self.res_place()

    def creat_radios(self):  # 选择器
        self.R_qinghua = Radiobutton(self.w,
                                     text='清华',
                                     variable=self.sorce,
                                     value='1')
        self.R_alibaba = Radiobutton(self.w,
                                     text='阿里',
                                     variable=self.sorce,
                                     value='2')
        self.R_douban = Radiobutton(self.w,
                                    text='豆瓣',
                                    variable=self.sorce,
                                    value='3')

    def res_place(self):  # 控件布局
        self.L_search.place(x=10, y=10, width=100, height=20)
        self.B_search.place(x=200, y=40, width=50, height=30)
        self.E_input.place(x=10, y=40, width=170, height=30)
        self.E_path.place(x=10, y=80, width=170, height=30)
        self.L_pack.place(x=10, y=113, width=200, height=23)
        self.L_packs.place(x=220, y=113, width=90, height=23)
        self.B_file.place(x=200, y=80, width=90, height=30)
        self.R_qinghua.place(x=110, y=10, width=60, height=20)
        self.R_alibaba.place(x=170, y=10, width=60, height=20)
        self.R_douban.place(x=230, y=10, width=60, height=20)
        self.L_box.place(x=10, y=140, width=140, height=175)
        self.L_box_se.place(x=180, y=140, width=120, height=120)
        self.B_down.place(x=250, y=279, width=50, height=28)
        self.B_add.place(x=186, y=279, width=50, height=28)
        self.S_col_y_1.place(x=150, y=140, width=15, height=175)
        self.S_col_x_1.place(x=10, y=315, width=140, height=15)
        self.S_col_y_2.place(x=300, y=140, width=15, height=120)
        self.S_col_x_2.place(x=180, y=260, width=120, height=15)
        self.L_message.place(x=170, y=308, width=140, height=28)

    def res_config(self):  # 滚动条配置
        self.S_col_y_1.config(command=self.L_box.yview)
        self.L_box["yscrollcommand"] = self.S_col_y_1.set
        self.S_col_x_1.config(command=self.L_box.xview)
        self.L_box["xscrollcommand"] = self.S_col_x_1.set
        self.S_col_y_2.config(command=self.L_box_se.yview)
        self.L_box_se["yscrollcommand"] = self.S_col_y_2.set
        self.S_col_x_2.config(command=self.L_box_se.xview)
        self.L_box_se["xscrollcommand"] = self.S_col_x_2.set
        self.B_file.config(command=self.select_menu)
        self.B_search.config(command=self.search_res)
        self.sorce.set('1')
        self.B_add.config(command=self.add_pack_to_box)
        self.B_down.config(command=self.lis_box_down)

    def select_menu(self):
        self.path_f = askdirectory()
        self.path_file.set(self.path_f)

    def clear_box(self):
        self.L_box.delete(0, END)

    def search_res(self):  # 查找库
        print('search')
        print(self.temp.get())
        self.clear_box()
        lis_new = []
        if self.temp.get() != '':
            lis = self.pp.get_cons(self.sorce.get())
            count = 0
            for s_str in lis:
                if self.temp.get() in s_str:
                    print('找到库{}'.format(s_str))
                    lis_new.append(s_str)
                else:
                    count += 1
            if count == len(lis):
                messagebox.showwarning(title='警告',
                                       message='没找到库{}'.format(
                                           self.temp.get()))
            msg = '找到{}个与{}相关的库'.format(len(lis_new), self.temp.get())
            print(msg)
            self.L_pack.config(text=msg)
            for msg in lis_new:
                self.L_box.insert(END, msg)
            return lis_new
        else:
            messagebox.showerror(title='警告', message='请输入库名')

    def add_pack_to_box(self):  # 添加列表至lisbox
        cur_index = self.L_box.curselection()
        print(cur_index)
        if len(cur_index) != 0:
            files_dic = self.pp.get_files_url(self.sorce.get(),
                                              self.L_box.get(cur_index))
            self.L_packs.config(text='各版本{}个'.format(len(files_dic)))
            for name, url in files_dic.items():
                self.L_box_se.insert(END, name)
        else:
            messagebox.showwarning(title='警告', message='请选择库')

    def lis_box_down(self):
        print('down')
        cur_index = self.L_box_se.curselection()
        if len(cur_index) != 0:
            print('路径', self.path_file.get())
            if self.path_file.get() != '':
                pack_name = self.L_box_se.get(cur_index).split('-')[0]
                if '_' in pack_name:
                    pack_name = pack_name.replace('_', '-')
                print(self.sorce.get(), pack_name,
                      self.L_box_se.get(cur_index), self.path_file.get())
                self.pp.down_file(self.sorce.get(), pack_name,
                                  self.L_box_se.get(cur_index),
                                  self.path_file.get())
                self.L_message.config(text='{}已下载'.format(pack_name))
            else:
                messagebox.showwarning(title='警告', message='请选择存储路径')
        else:  # 如果没选择
            messagebox.showwarning(title='警告', message='请选择库')
示例#21
0
class App_test(object):
    def __init__(self, master, fuc):
        self.win = master
        self.win.title('12306火车票查询系统V2.6')
        curWidth = self.win.winfo_width()
        curHeight = self.win.winfo_height()
        scnWidth, scnHeight = self.win.maxsize()
        tmpcnf = '1130x600+500+300'  # % ((scnWidth - curWidth) / 2, (scnHeight - curHeight) / 2)
        self.win.geometry(tmpcnf)
        self.creat_res()
        self.add_train_info()
        self.add_check_button()
        self.res_config(fuc)
        self.set_combox_defaut()
        self.train_message = {}

    # self.get_train_args()
    # self.win.mainloop()

    def creat_res(self):
        self.v = IntVar()  # 车票查询
        self.v.set(True)
        self.temp = StringVar()  # 开始站
        self.temp2 = StringVar()  # 目的站
        self.start_mon = StringVar()  # 出发月
        self.start_day = StringVar()  # 出发日
        self.start_year = StringVar()  # 出啊年
        self.La_start_end = Label(self.win, text="请输入出发地和目的地", fg="blue")
        self.E_startstation = Entry(self.win, textvariable=self.temp)
        self.E_endstation = Entry(self.win, textvariable=self.temp2)
        self.La_startstation = Label(self.win, text="出发站:")
        self.La_endstation = Label(self.win, text="目的站:")
        self.La_time = Label(self.win, text="请选择出发时间-年-月-日", fg="blue")
        self.B_search = Button(self.win, text="搜索")
        self.R_site = Radiobutton(self.win,
                                  text="车票查询",
                                  variable=self.v,
                                  value=True)
        self.R_price = Radiobutton(self.win,
                                   text="票价查询",
                                   variable=self.v,
                                   value=False)
        self.B_buy_tick = Button(self.win, text="购票")
        self.C_year = Combobox(self.win, textvariable=self.start_year)
        self.La_s = Label(self.win, text="--")
        self.C_mon = Combobox(self.win, textvariable=self.start_mon)
        self.La_s1 = Label(self.win, text="--")
        self.C_day = Combobox(self.win, textvariable=self.start_day)
        # 滚动条
        self.S_move = Scrollbar(self.win)
        self.La_start_end.place(x=10, y=10, width=150, height=30)
        self.E_startstation.place(x=70, y=50, width=145, height=30)
        self.E_startstation.insert(10, "杭州东")
        self.E_endstation.place(x=70, y=100, width=145, height=30)
        self.E_endstation.insert(10, "南京南")
        self.La_startstation.place(x=10, y=50, width=50, height=30)
        self.La_endstation.place(x=10, y=100, width=50, height=30)
        self.La_time.place(x=0, y=140, width=190, height=30)
        self.C_year.place(x=10, y=180, width=70, height=30)
        self.La_s.place(x=80, y=180, width=20, height=30)
        self.C_mon.place(x=100, y=180, width=50, height=30)
        self.La_s1.place(x=150, y=180, width=20, height=30)
        self.C_day.place(x=170, y=180, width=50, height=30)
        self.B_search.place(x=10, y=220, width=80, height=40)
        self.S_move.place(x=1100, y=40, width=30, height=550)
        self.B_buy_tick.place(x=10, y=310, width=80, height=40)
        self.R_site.place(x=10, y=270, width=90, height=30)
        self.R_price.place(x=100, y=270, width=90, height=30)

    def res_config(self, fuc):
        localTime = time.localtime(int(time.time()))
        # 获取今年的年份
        startTime = int(time.strftime("%Y", localTime))  # 2018
        self.C_year.config(
            values=[x for x in range(startTime, startTime + 10)])
        self.C_mon.config(values=["{:02d}".format(x)
                                  for x in range(1, 13)])  # 时间格式是2018-01-01
        self.C_day.config(values=["{:02d}".format(x) for x in range(1, 32)])
        self.B_search.config(command=fuc)
        self.S_move.config(command=self.tree.yview)
        self.tree.config(yscrollcommand=self.S_move.set)

    def add_train_info(self):
        lis_train = ["C" + str(x) for x in range(0, 15)]
        tuple_train = tuple(lis_train)
        self.tree = Treeview(self.win,
                             columns=tuple_train,
                             height=30,
                             show="headings")
        self.tree.place(x=228, y=40, width=870, height=550)
        train_info = [
            ' 车次 ', ' 出发/到达站', '出发/到达时间', '历时 ', '商/特座', '一等座', '二等座', '高软',
            '软卧', '动卧', '硬卧', '软座', '硬座', '无座', '其他'
        ]
        for i in range(0, len(lis_train)):
            self.tree.column(lis_train[i],
                             width=len(train_info[i]) * 11,
                             anchor='center')
            self.tree.heading(lis_train[i], text=train_info[i])

    def add_check_button(self):
        self.v1 = IntVar()
        self.v2 = IntVar()
        self.v3 = IntVar()
        self.v4 = IntVar()
        self.v5 = IntVar()
        self.v6 = IntVar()
        self.v7 = IntVar()
        self.v1.set("T")
        self.Check_total = Checkbutton(self.win,
                                       text="全部车次",
                                       variable=self.v1,
                                       onvalue='T')
        self.Check_total.place(x=228, y=7, width=90, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="G-高铁",
                                       variable=self.v2,
                                       onvalue='T')
        self.Check_total.place(x=318, y=7, width=70, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="D-动车",
                                       variable=self.v3,
                                       onvalue='T')
        self.Check_total.place(x=398, y=7, width=70, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="Z-直达",
                                       variable=self.v4,
                                       onvalue='T')
        self.Check_total.place(x=478, y=7, width=70, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="T-特快",
                                       variable=self.v5,
                                       onvalue='T')
        self.Check_total.place(x=558, y=7, width=70, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="K-快速",
                                       variable=self.v6,
                                       onvalue='T')
        self.Check_total.place(x=638, y=7, width=70, height=30)
        self.Check_total = Checkbutton(self.win,
                                       text="其他",
                                       variable=self.v7,
                                       onvalue='T')
        self.Check_total.place(x=718, y=7, width=70, height=30)

    # 设置下拉框默认值
    def set_combox_defaut(self):
        localTime = time.localtime(int(time.time()))
        mon = int(time.strftime("%m", localTime))
        day = int(time.strftime("%d", localTime))
        self.C_year.current(0)
        self.C_mon.current(mon - 1)
        self.C_day.current(day - 1)
示例#22
0
class MainWindow:
    def __init__(self) -> None:
        self.Root = Tk()
        self.App = Frame(self.Root, padding=(5, 2))
        self.UpdatesFrame = LabelFrame(self.App, text='Обновление',
                                       borderwidth=2, relief='sunken', padding=(5, 2))
        self.upd_enabled = BooleanVar()  # Флаг обновлений
        self.upd_unit = StringVar()  # Единица измерения времени
        self.time_units = {Minutes: 'Минут', Hours: 'Часов',
                           Days: 'Дней', Weeks: 'Недель', Months: 'Месяцев'}
        self.size_units = {Bytes: 'Байт', KBytes: 'Кбайт', MBytes:'Мбайт',
                           GBytes:'Гбайт', TBytes:'Тбайт'}  # Список единиц измерения времени
        self.maxfsize = StringVar()  # Максимальный размер файла
        self.size_unit = StringVar()  # Единица измерения информации
        self.units_amount1 = StringVar()  # Количество единиц
        self.quar = BooleanVar()  # False - удалять, True - карантин
        self.quar_path = StringVar() # Расположение карантина
        self.rpt_enabled = BooleanVar()  # Флаг отправки отчета
        self.email = StringVar()  # Адрес отправки
        self.passwd = StringVar() # Пароль исходящего ящика
        self.rpt_unit = StringVar()  # Единица измерения времени
        self.units_amount2 = StringVar()  # Количество единиц

        self.Upd_Label1 = Label(self.UpdatesFrame, text='Проверять обновления антивирусных баз')
        self.Upd_Checkbutton1 = Checkbutton(self.UpdatesFrame, variable=self.upd_enabled)
        self.Upd_Label2 = Label(self.UpdatesFrame, text='Частота проверки:   каждые')
        self.Upd_Spinbox1 = Spinbox(self.UpdatesFrame, textvariable=self.units_amount1,
                                    from_=1, to=999999999, width=4)
        self.Upd_OptionMenu1 = OptionMenu(self.UpdatesFrame, self.upd_unit, *self.time_units.values())
        self.Upd_Button1 = Button(
            self.UpdatesFrame, text='Источники антивирусных сигнатур', command=EntryOptionsWindow('AV_SOURCES', self.Root).main)

        self.ScanFrame = LabelFrame(self.App, text='Сканирование',
                                    borderwidth=2, relief='sunken', padding=(5, 2))
        self.Scn_Label1 = Label(self.ScanFrame, text='Максимальный размер файла:')
        self.Scn_Spinbox1 = Spinbox(self.ScanFrame, textvariable=self.maxfsize,
                                    from_=0, to=999999999, width=8)

        self.Quar_Label = Label(self.ScanFrame, text='При обнаружении угрозы')
        self.Quar_RadButton1 = Radiobutton(self.ScanFrame, text='Удаление', variable=self.quar, value=False)
        self.Quar_RadButton2 = Radiobutton(self.ScanFrame, text='Карантин', variable=self.quar, value=True)

        self.Scn_OptionMenu1 = OptionMenu(self.ScanFrame, self.size_unit, *self.size_units.values())
        self.Scn_Edit_Targets = Button(self.ScanFrame, text='Цели сканирования', command=EntryOptionsWindow('SCAN_TARGETS', self.Root, select_path=True).main)
        self.Scn_Edit_Exceptions = Button(self.ScanFrame, text='Исключения', command=EntryOptionsWindow('SCAN_EXCLUDE', self.Root).main)
        self.Quar_Button1 = Button(self.ScanFrame, text='Расположение карантина',
                                   command=lambda: self.quar_path.set(filedialog.askdirectory()))

        self.ReportFrame = LabelFrame(self.App, text='Отправка отчета',
                                      borderwidth=2, relief='sunken', padding=(5, 2))

        self.Rpt_Label1 = Label(self.ReportFrame, text='Отправлять отчеты о сканировании')
        self.Rpt_Checkbutton1 = Checkbutton(self.ReportFrame, variable=self.rpt_enabled)
        self.Rpt_Label2 = Label(self.ReportFrame, text='Адрес отправки отчетов:')
        self.Rpt_Entry1 = Entry(self.ReportFrame, textvariable=self.email, width=32)
        self.Rpt_Label3 = Label(self.ReportFrame, text='Пароль:')
        self.Rpt_Entry2 = Entry(self.ReportFrame, textvariable=self.passwd, width=32, show='*')
        self.Rpt_Label4 = Label(self.ReportFrame, text='Частота:')
        self.Rpt_Spinbox1 = Spinbox(self.ReportFrame, textvariable=self.units_amount2,
                                    from_=1, to=999999999, width=4)
        self.Rpt_OptionMenu1 = OptionMenu(self.ReportFrame, self.rpt_unit, *self.time_units.values())
        self.Rpt_Button1 = Button(self.ReportFrame, text='Получатели', command=EntryOptionsWindow('SEND_TO', self.Root).main)

        self.Buttons = Frame(self.App, padding=(5, 2))
        self.Button1 = Button(self.Buttons, text='Готово', command=self.save_conf)
        self.Button2 = Button(self.Buttons, text='Отмена', command=self.Root.destroy)

    def main(self) -> None:
        self.upd_unit.set(self.time_units[type(UPDATE_FREQ)])
        self.units_amount1.set(UPDATE_FREQ.value)
        self.upd_enabled.set(CHECK_FOR_UPDATES)
        self.Upd_Checkbutton1.configure(command=(
            lambda: self.__change_state(
                self.upd_enabled, self.Upd_Label2, self.Upd_Spinbox1, self.Upd_OptionMenu1, self.Upd_Button1)
            and self.upd_enabled.set(not self.upd_enabled.get())))
        self.Rpt_Checkbutton1.configure(command=(
            lambda: self.__change_state(
                self.rpt_enabled, self.Rpt_Label2, self.Rpt_Entry1, self.Rpt_Label3, self.Rpt_Entry2,
                 self.Rpt_Label4, self. Rpt_Spinbox1, self.Rpt_OptionMenu1, self.Rpt_Button1)
                 and self.rpt_enabled.set(not self.rpt_enabled.get())))
        self.maxfsize.set(MAX_FILE_SIZE.value)
        self.size_unit.set(self.size_units[type(MAX_FILE_SIZE)])
        self.quar.set(REMOVE_THREATS)
        self.quar_path.set(QUARANTINE_PATH)
        self.rpt_enabled.set(SEND_SCAN_REPORTS)
        self.email.set(SEND_FROM)
        self.passwd.set(SEND_PASSWD)
        self.rpt_unit.set(self.time_units[type(SEND_FREQ)])
        self.units_amount2.set(SEND_FREQ.value)

        self.App.pack(fill='both', expand=True)
        center_win(self.Root, '500x500')
        self.Root.resizable(False, False)
        self.Root.title('CobraAV Configuration')

        self.UpdatesFrame.place(y=0, height=150, width=490)
        self.__change_state(self.upd_enabled, self.Upd_Label2,
                            self.Upd_Spinbox1, self.Upd_OptionMenu1)

        self.__change_state(self.rpt_enabled, self.Rpt_Label2, self.Rpt_Entry1, self.Rpt_Label3,
                            self.Rpt_Entry2, self.Rpt_Label4, self.Rpt_Spinbox1, self.Rpt_OptionMenu1, self.Rpt_Button1)

        self.Upd_Label1.place(relx=.01, rely=.05)  # Проверять обновления ?
        self.Upd_Checkbutton1.place(relx=.8, rely=.05)  # Да/Нет

        self.Upd_Label2.place(relx=.01, rely=.3)  # Частота проверки
        self.Upd_Spinbox1.place(relx=.55, rely=.3, width=60)  # Количество
        self.Upd_OptionMenu1.place(relx=.72, rely=.28)  # Единицы измерения
        self.Upd_Button1.place(relx=.01, rely=.65)  # Источники сигнатур

        self.ScanFrame.place(y=150, height=150, width=490)

        self.Scn_Label1.place(relx=.01, rely=.05)  # Максимальный размер файла
        self.Scn_Spinbox1.place(relx=.55, rely=.05, width=60)  # Количество

        self.Quar_Label.place(relx=.01, rely=.35)
        self.Quar_RadButton1.place(relx=.52, rely=.35)  # Переключатель на удаление угрозы
        self.Quar_RadButton2.place(relx=.72, rely=.35)  # Переключатель на добавление вкарантина угрозы
        self.Quar_Button1.place(relx=.56, rely=.65)  # Расположение карантина

        self.Scn_OptionMenu1.place(relx=.72, rely=.014)  # Единицы измерения
        self.Scn_Edit_Targets.place(relx=.01, rely=.65)  # Цели сканирования
        self.Scn_Edit_Exceptions.place(relx=.33, rely=.65)  # Исключения

        self.Rpt_Label1.place(relx=.01, rely=.05)  # Отправлять отчеты ?
        self.Rpt_Checkbutton1.place(relx=.8, rely=.05)  # Да/Нет

        self.ReportFrame.place(y=300, height=150, width=490)
        self.Rpt_Label2.place(relx=.01, rely=.35)  # Адрес отправки отчетов:
        self.Rpt_Entry1.place(relx=.35, rely=.35)  # Ввод адреса отправки отчетов
        self.Rpt_Label3.place(relx=.01, rely=.50) # Пароль:
        self.Rpt_Entry2.place(relx=.35, rely=.50) # Ввод пароля:
        self.Rpt_Label4.place(relx=.01, rely=.75)  # Частота отправки
        self.Rpt_Spinbox1.place(relx=.35, rely=.75, width=60)  # Количество
        self.Rpt_OptionMenu1.place(relx=.52, rely=.72)  # Единицы измерения
        self.Rpt_Button1.place(relx=.72, rely=.74) # Получатели

        self.Buttons.place(y=450, height=50, width=490)
        self.Button1.place(relx=.62, rely=.2) # Кнопка "Готово"
        self.Button2.place(relx=.82, rely=.2) # Кнопка "Отмена"

        self.Root.mainloop()

    @staticmethod
    def __change_state(state: BooleanVar, *args: Widget) -> None:
        for i in args:
            i.configure(state=('disabled', 'normal')[state.get()])

    def save_conf(self) -> None:
        size_units = {v: k for k, v in self.size_units.items()}
        time_units = {v: k for k, v in self.time_units.items()}

        def wrap_list(a: 'list[str]') -> str:
            return '[' + ', '.join(f"r'{i}'" for i in a) + ']'

        def wrap_cls(_unit: Variable, amount: Variable) -> str:
            unit = _unit.get()
            if unit in size_units:
                return size_units[unit].__name__ + f'({amount.get()})'
            elif unit in time_units:
                return time_units[unit].__name__ + f'({amount.get()})'
            else:
                raise NotImplementedError

        with open(CONF_PATH, 'w') as f:
            f.write(
                f"""from libunits import *

CHECK_FOR_UPDATES = {int(self.upd_enabled.get())}  # Check for updates
UPDATE_FREQ = {wrap_cls(self.upd_unit, self.units_amount1)}  # Check interval
MAX_FILE_SIZE = {wrap_cls(self.size_unit, self.maxfsize)}  # Max file size

# Antivirus database sources
AV_SOURCES = {wrap_list(AV_SOURCES)}

# Antivirus database path
DB_PATH = r'{DB_PATH}'

# On threat:
# 0 - quarantine
# 1 - remove
REMOVE_THREATS = {int(self.quar.get())}

# Directories to scan
SCAN_TARGETS = {wrap_list(SCAN_TARGETS)}

# Exclude from scanning
SCAN_EXCLUDE = {wrap_list(SCAN_EXCLUDE)}

# quarantine location
QUARANTINE_PATH = r'{self.quar_path.get() or QUARANTINE_PATH}'

# Send scan reports
SEND_SCAN_REPORTS = {int(self.rpt_enabled.get())}

# Scan reports frequency
SEND_FREQ = {wrap_cls(self.rpt_unit, self.units_amount2)}

# Send from this email
SEND_FROM = r'{self.email.get()}'

# Sender email password
SEND_PASSWD = r'{self.passwd.get()}'

# Send to these emails
SEND_TO = {wrap_list(SEND_TO)}
""")
        self.Root.destroy()
示例#23
0
TCombobox1.configure(state="readonly")
TCombobox1['values'] = photos

Frame3 = Frame(root)
Frame3.place(relx=0.02, rely=0.33, relheight=0.63, relwidth=0.46)
Frame3.configure(relief=GROOVE)
Frame3.configure(borderwidth="2")
Frame3.configure(relief=GROOVE)
Frame3.configure(width=285)

Label4 = Label(Frame3)
Label4.place(relx=0.04, rely=-0.04, height=21, width=44)
Label4.configure(text='''Follow''')

Radiobutton1 = Radiobutton(Frame3)
Radiobutton1.place(relx=0.07, rely=0.08, relheight=0.09, relwidth=0.38)
Radiobutton1.configure(text='''Single Hashtag''')
Radiobutton1.configure(variable=radio)
Radiobutton1.configure(value="1")
Radiobutton1.invoke()

TCombobox3 = Combobox(Frame3)
TCombobox3.place(relx=0.11, rely=0.19, relheight=0.08, relwidth=0.6)
TCombobox3.configure(textvariable=combobox2)
TCombobox3.configure(width=173)
TCombobox3.configure(takefocus="")
TCombobox3['values'] = hashtags

Radiobutton2 = Radiobutton(Frame3)
Radiobutton2.place(relx=0.07, rely=0.3, relheight=0.09, relwidth=0.44)
Radiobutton2.configure(text='''Multiple Hashtags''')
示例#24
0
def circle_GO():
    """ Функция, реагирующая на нажатие кнопки выбора фигуры(Круга) и запускающая необходимые запросы для расчёта. """

    # Обновление правой части калькулятора (ничего лучше не сработало).
    right_label_frame = LabelFrame(window, text='Брутальный калькулятор', width=600, height=500)
    right_label_frame.place(x=320, y=10)

    # Первый запрос (выбор способа расчёта).
    first_question_circle = Label(right_label_frame, text="1) Выберите каким способом будет получен расчёт:")
    first_question_circle.place(x=20, y=30)

    def conclusion():
        """ Вывод расчёта пользователю когда тот введёт необходимые данные. """
        data_output = Label(right_label_frame, text="3) Получен результат:")
        data_output.place(x=20, y=300)

    # Вывод трёх переключателей для выбора пользователем, от которых зависит метод расчёта.
    selected = IntVar()
    rad1 = Radiobutton(right_label_frame, text='Известен радиус', value=1, variable=selected)
    rad2 = Radiobutton(right_label_frame, text='Известен диаметр', value=2, variable=selected)
    rad3 = Radiobutton(right_label_frame, text='Известна длина окружности', value=3, variable=selected)
    rad1.place(x=25, y=60)
    rad2.place(x=25, y=90)
    rad3.place(x=25, y=120)

    def data_request():
        """ Функция вывода второго вопроса с запросом известной величины и самой калькуляцией. """

        # Вывод поля для заполнения известной величиной.
        message = DoubleVar()
        entry = Entry(right_label_frame, width=10, textvariable=message)
        entry.place(x=25, y=233)

        def calculation_for():
            """ Калькуляция(расчёт площади круга по формулам). """

            if selected.get() == 1:
                # Расчёт площади круга по радиусу.
                r = message.get()
                S = math.pi * (r ** 2)
                # Вывод расчёта пользователю с округлением.
                conclusion()
                data_output_conclusion = Label(right_label_frame, text=round(S, 2), font=("Arial Bold", 50))
                data_output_conclusion.place(x=20, y=350)
            elif selected.get() == 2:
                # Расчёт площади круга по диаметру.
                d = message.get()
                S = 0.25 * math.pi * (d ** 2)
               # Вывод расчёта пользователю с округлением.
                conclusion()
                data_output_conclusion = Label(right_label_frame, text=round(S, 2), font=("Arial Bold", 50))
                data_output_conclusion.place(x=20, y=350)
            elif selected.get() == 3:
                # Расчёт площади круга по длине окружности.
                L = message.get()
                S = (L ** 2) / (4 * math.pi)
                # Вывод расчёта пользователю с округлением.
                conclusion()
                data_output_conclusion = Label(right_label_frame, text=round(S, 2), font=("Arial Bold", 50))
                data_output_conclusion.place(x=20, y=350)

        # Кнопка подтверждения ввода известных величин. Требование рассчитать при нажатии.
        btn_calculation = Button(right_label_frame, text="Рассчитать!", command=calculation_for)
        btn_calculation.place(x=100, y=230)

        # Вывод второго вопроса.
        second_question_circle = Label(right_label_frame, text="2) Введите известную величину в появившемся окне и нажмите на кнопку рассчёта.")
        second_question_circle.place(x=20, y=200)

    # Кнопка подтверждения выбора метода расчёта.
    button_right_menu1 = Button(right_label_frame, text="Выбрать!", command=data_request)
    button_right_menu1.place(x=25, y=150)
示例#25
0
input_lbl = Label(window, text=line)  # неактивна надпись слева
input_lbl.place(x=20, y=10)

message = StringVar()
txt = Entry(window, textvariable=message)  # ввод с клавиатуры
txt.place(x=120, y=10)

txt.focus()  # фокус на окно ввода при запуске
search =message.get()  # message= значение из окна ввода


btn = Button(text=" OK ",command=click_button) # конструктор BUTTON
btn.place(x=350,y=10)

sel = IntVar()                          # переменная для хранения состояний виджетов
sel.set(0)                              # присваиваем для sel значение 0
rad1 = Radiobutton(window, text='Создать базы SUPPLIERS и SUPPLY_GROUP?',variable=sel,value=1)# sel.get()=1
rad2 = Radiobutton(window, text='Вывод базы SUPPLIERS   ',variable=sel,value=2)  # sel.get()=2
rad3 = Radiobutton(window, text='Вывод базы SUPPLY_GROUP',variable=sel,value=3)  # sel.get()=3
rad4 = Radiobutton(window, text='Добавить запись?      ',variable=sel,value=4)   # sel.get()=4
rad5 = Radiobutton(window, text='Найти запись?        ',variable=sel,value=5)    # sel.get()=5
rad1.place(x=10, y=50)
rad2.place(x=10, y=80)
rad3.place(x=10, y=110)
rad4.place(x=10, y=140)
rad5.place(x=10, y=170)

window.mainloop()                        #отображение окна#
con.close()
###########################################
示例#26
0
class CompilationScreen(TkPage):
    Name = 'Compilation'
    Font = lambda Size: ('Courier', Size) #font of the page

    def __init__(self, Parent, *args, **kwargs):
        super().__init__() #constructor of super class
        self.Songs = [Song for Song in DirList('Songs') if Song.endswith('.mid')] #mappable songs
        self.MappedSongs = [Song for Song in DirList('MappedSongs') if Song.endswith('.cmid')] #mapped and compiled song

        TopLabel = Label(self, text = 'Compile a Song', font= CompilationScreen.Font(24), bd = 10) #top label with a title for the page
        TopLabel.place(anchor= 'n', relx= 0.5, rely = 0.015, relwidth = 1, relheight=0.15) #placing the label

        self.ItemList = ListBox(self) #item list of the song
        for Index, Item in enumerate(self.Songs): #for loop for every compiled comiled song
            self.ItemList.insert(Index, Item) #indexing the song in the list
            self.ItemList.itemconfig(Index, {'bg' : '#C2C2C2'})
        self.ItemList.place(anchor= 'n', relx= 0.5, rely = 0.19, relwidth = 1, relheight = 0.46) #placing the item list

        self.ApproxValue = IntVar()
        self.ApproxValue.set(1)
        self.SingleTracks = IntVar()
        self.SingleTracks.set(0)

        self.Closest = Radio(self, text = 'Closest Approximation (A# = A, A- = A)', variable = self.ApproxValue, value = 1)
        self.Closest.place(anchor = 'nw', relx = 0.008, rely = 0.65, relheight = 0.07, relwidth = 0.6)
        self.Upper = Radio(self, text = 'Upper Approximation (A# = B, A- = A)', variable = self.ApproxValue, value = 0)
        self.Upper.place(anchor = 'nw', relx = 0.008, rely = 0.71, relheight = 0.07, relwidth = 0.6)
        self.Split = Check(self, text = 'Split MIDI into single tracks', variable = self.SingleTracks, onvalue = 1, offvalue = 0)
        self.Split.place(anchor = 'nw', relx = 0.008, rely = 0.77, relheight = 0.07, relwidth = 0.6)

        self.Compilation = Button\
        (
            self,
            text = 'Compile selected song',
            command = lambda : self.CompileSong()
        )
        self.Compilation.place(anchor = 'nw', relx = 0.615, rely = 0.66, relheight = 0.17, relwidth = 0.38)

        self.Back = Button\
        (
            self,
            text = 'Back to Home',
            command = lambda : self.TurnBack()
        )
        self.Back.place(anchor = 'nw', relx = 0.008, rely = 0.84, relheight = 0.07, relwidth = 0.988)

    def CompileSong(self):
        Song = str(self.ItemList.get('active'))
        Approximation = bool(self.ApproxValue.get())
        SplitMIDI = bool(self.SingleTracks.get())

        if Approximation:
            print('closest approximation')
            Compile(Song, True, False, SplitMIDI)
        else:
            print('upper approximation')
            Compile(Song, False, True, SplitMIDI)

    def TurnBack(self):
        GenshinLyrePlayer.Raise(Home.Name)

    def Refresh(self): #this function update the song list
        self.Songs = [Song for Song in DirList('Songs') if Song.endswith('.mid')] #check the folder for the songs
        self.ItemList.delete('0','end') #delete every item of the list
        for Index, Item in enumerate(self.Songs): #loop for every song in the folder
            self.ItemList.insert(Index, Item) #index the song in the item list
            self.ItemList.itemconfig(Index, {'bg' : '#C2C2C2'}) #background of the itemlist