def beginSearch(event): global cursor global inner_frame global sf global authorKey #удаление прокручиваемого блока, если он существует if(not(inner_frame is None)): inner_frame.destroy() sf.destroy() sf1.configure(highlightbackground="#ffffff") #Создание прокручиваемого блока sf = ScrolledFrame(root, width=640, height=480, highlightthickness=5, highlightbackground="red") sf.itemId=0 sf.pack(side="top", expand=1, fill="both") sf.bind_arrow_keys(root) sf.bind_scroll_wheel(root) sf.bind("<Enter>", hoverFrame) inner_frame = sf.display_widget(Frame, True) #параметры обработанных статей author = "author" theme = "theme" name = "name" link = "link" author_inputted = getAuthor(authorKey.get()) print(author_inputted) keywords = [] for s in getKeywords(boolArr): keywords.append(s) command = "select Book.Name,Book.Author,Book.Cloud_Link, Book.Language, Book.Format from Book" command += """\njoin BookKeyWord on Book.Id = BookKeyWord.Book_Id\njoin KeyWord on BookKeyWord.KeyWord_Id = KeyWord.Id""" keywords_count = len(keywords) if keywords_count > 0: command = command + "\nwhere Keyword.Name = N'###KEYWORD###'" pattern = command for i in range(keywords_count): if i != 0: command = command + "\nintersect\n" + pattern.replace("###KEYWORD###",keywords[i]) else: command = command.replace("###KEYWORD###",keywords[i]) if not (author_inputted == "ЛЮБОЙ"): command = command + " and Book.Author = N'" + author_inputted + "'" else: if not (author_inputted == "ЛЮБОЙ"): command = command + "\nwhere Book.Author = N'" + author_inputted + "'" print(command) cursor.execute(command) for book in cursor.fetchall(): printArticle(book[1], book[0], book[2], book[3], book[4], inner_frame) """
#------------------------------------------------------------------------------------------------ #второй фрейм #------------------------------------------------------------------------------------------------ fr2 = Frame(bg="#ffffff", width = 100) #подсказка для пользователя Label(fr2, text="Автор:", width = 100, height = 2, font="Arial 13").pack() #Создание прокручиваемого блока для кчпичка авторов sf2 = ScrolledFrame(fr2, width=880, height=100, highlightthickness=5, highlightbackground="#ffffff") sf2.itemId=2 sf2.pack(side="top", expand=0) sf2.bind_arrow_keys(root) sf2.bind_scroll_wheel(root) sf2.bind("<Enter>", hoverFrame) frame_authors = sf2.display_widget(Frame, True) #значения выпадающего списка arrAuth = getDBAuthors() #количество значений в списке(нужно для программы) length1 = len(arrAuth) #массив булеан значений, сопоставляемый списку authorKey = IntVar() authorKey.set(0) #добавление на экран флажков for i in range(0, length1): checkbox = Radiobutton(frame_authors, text = arrAuth[i], variable = authorKey, value=i)