def __init__(self, ls: str, tk: Tk, select_path=False) -> None: if not EntryOptionsWindow.instanciated: self.select_path = select_path self.List = ls self.Tk = tk self.Root = Toplevel(self.Tk) self.Root.withdraw() self.Root.protocol("WM_DELETE_WINDOW", self.__close) self.ListFrame = Frame(self.Root) self.Box = Listbox(self.ListFrame, selectmode='extended', width=54, height=24) for i in globals()[self.List]: self.Box.insert(END, i) self.Scroll = Scrollbar(self.ListFrame, command=self.Box.yview) self.ButtonsFrame = Frame(self.Root) self.Scroll2 = Scrollbar(self.ButtonsFrame, command=self.Box.xview, orient='horizontal') self.Entry = Entry(self.ButtonsFrame) self.ButtonAdd = Button(self.ButtonsFrame, text='Добавить', command=self.__add_item) self.ButtonDel = Button(self.ButtonsFrame, text='Удалить', command=self.__del_item) self.ButtonDone = Button(self.ButtonsFrame, text='Готово', command=self.__save_list) self.ButtonExit = Button(self.ButtonsFrame, text='Отмена', command=self.__close) EntryOptionsWindow.instanciated = True self.main()
def __init__(self, parent): self.unslc = [] self.slc = [] self.frame = Frame(parent) self.unslcLabel = Label(self.frame) self.slcLabel = Label(self.frame) self.unselListbox = Listbox(self.frame, selectmode=EXTENDED, width=39) unselListboxScroll = Scrollbar(self.frame) unselListboxScroll['command'] = self.unselListbox.yview self.unselListbox['yscrollcommand'] = unselListboxScroll.set self.selButton = Button(self.frame, text='>>') self.unselButton = Button(self.frame, text='<<') self.selListbox = Listbox(self.frame, selectmode=EXTENDED, width=39) selListboxScroll = Scrollbar(self.frame) selListboxScroll['command'] = self.selListbox.yview self.selListbox['yscrollcommand'] = selListboxScroll.set self.unslcLabel.grid(row=0, column=0, columnspan=2, padx=5, pady=5) self.slcLabel.grid(row=0, column=3, columnspan=2, padx=5, pady=5) self.unselListbox.grid(row=1, rowspan=2, column=0) unselListboxScroll.grid(row=1, rowspan=2, column=1, sticky='ns') self.selButton.grid(row=1, column=2, padx=5, pady=5, sticky='s') self.unselButton.grid(row=2, column=2, padx=5, pady=5, sticky='n') self.selListbox.grid(row=1, rowspan=2, column=3) selListboxScroll.grid(row=1, rowspan=2, column=4, sticky='ns') self.frame.pack()
def __init__(self): super(Window, self).__init__() self.conf = Config() self.analyser = Analyser(self.conf) self.theme = None # Respect PEP8 self.set_theme(self.conf.get("gui.tkinter.theme", "default")) self.title("PyCreator") self.state("zoomed") self.menu = tk.Menu(self) self.filemenu = FileMenu(self, self.menu) self.executemenu = ExecuteMenu(self, self.menu) self.codemenu = CodeMenu(self, self.menu) self.parametersmenu = ParametersMenu(self, self.menu) self.filesview = FilesWidget(self) self.tabeditor = TabEditorWidget(self) self.sh = Scrollbar() self.sv = Scrollbar() self.setup_ui() self.bind_event() self.protocol("WM_DELETE_WINDOW", self.on_close) self.mainloop()
def create_canvas(self): canvas=Canvas(self,scrollregion=(-1520,-22200,1520,22200),bg='white') #创建canvas canvas.pack(side=LEFT, fill=BOTH, ipadx=2, ipady=2, expand=1) # 放置canvas的位置 frame_send=Frame(canvas,background='yellow') frame_send.pack(side=TOP,fill=NONE,expand=0) frame_res=Frame(canvas,background='green') #把frame放在canvas里 frame_res.pack(side=TOP, fill=NONE, expand=NO) #frame的长宽,和canvas差不多的 vbar=Scrollbar(canvas,orient=VERTICAL) #竖直滚动条 vbar.pack(side=RIGHT, fill=Y, ipadx=2, ipady=2, expand=0) vbar.configure(command=canvas.yview) hbar=Scrollbar(canvas,orient=HORIZONTAL)#水平滚动条 hbar.pack(side=BOTTOM, fill=X, ipadx=2, ipady=2, expand=0) hbar.configure(command=canvas.xview) canvas.config(xscrollcommand=hbar.set,yscrollcommand=vbar.set) #设置 canvas.create_window((120,240), window=frame_res) #create_window self.create_frame_send(frame_send,frame_res) self.after(1000,print(""))
def init_local_tree(self): self.ex_loc_tree = Treeview(self.master) ysb = Scrollbar(self.master, orient='vertical', command=self.ex_loc_tree.yview) xsb = Scrollbar(self.master, orient='horizontal', command=self.ex_loc_tree.xview) self.ex_loc_tree.configure(yscroll=ysb.set, xscroll=xsb.set) # self.ex_loc_tree.grid( # row=100, # sticky=W, # padx=20 # ) n1 = "%s files found" % str(self.ex_loc_tree.size()) self.set_found_local_label(n1) self.ex_loc_tree.bind("<ButtonRelease-1>", lambda event, tv_obj=self.ex_loc_tree: self. treeviewClick(event, tv_obj)) folder_name = basename(self.dir) self.ex_loc_tree.heading('#0', text=basename(folder_name), anchor='w') abs_path = abspath(self.dir) root_node = self.ex_loc_tree.insert('', 'end', text=folder_name, open=True) self.process_loc_dir(root_node, abs_path) self.ex_loc_tree.grid(row=0, column=0) # Set Scrollbar # ysb.grid(row=0, column=1, sticky='ns') # xsb.grid(row=1, column=0, sticky='ew') self.master.grid()
def _setup_widgets(self): msg = Label( wraplength="4i", justify="left", anchor="n", padding=(10, 2, 10, 6), text=("Ttk is the new Tk themed widget set. One of the widgets it " "includes is a tree widget, which can be configured to " "display multiple columns of informational data without " "displaying the tree itself. This is a simple way to build " "a listbox that has multiple columns. Clicking on the " "heading for a column will sort the data by that column. " "You can also change the width of the columns by dragging " "the boundary between them.")) msg.pack(fill='x') container = Frame() container.pack(fill='both', expand=True) # XXX Sounds like a good support class would be one for constructing # a treeview with scrollbars. self.tree = Treeview(columns=tree_columns, show="headings", style='font.Treeview') vsb = Scrollbar(orient="vertical", command=self.tree.yview) hsb = Scrollbar(orient="horizontal", command=self.tree.xview) self.tree.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set) self.tree.grid(column=0, row=0, sticky='nsew', in_=container) vsb.grid(column=1, row=0, sticky='ns', in_=container) hsb.grid(column=0, row=1, sticky='ew', in_=container) container.grid_columnconfigure(0, weight=1) container.grid_rowconfigure(0, weight=1)
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 _setup_widgets(self): topf = Frame() topf.pack() refreshb = Button(topf, text="Refresh", command=refreshData) refreshb.pack(side=LEFT) global modeb, themeb modeb = Button(topf, text="App Mode", command=changeMode) modeb.pack(side=LEFT) themeb = Button(topf, text="Dark Mode", command=changeTheme) themeb.pack(side=LEFT) exitb = Button(topf, text="Exit", command=exitWidgetGui) exitb.pack(side=RIGHT) container = Frame() container.pack(fill='both', expand=True) # create a treeview with dual scrollbars self.tree = Treeview(columns=country_header, show="headings") vsb = Scrollbar(orient="vertical", command=self.tree.yview) hsb = Scrollbar(orient="horizontal", command=self.tree.xview) self.tree.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set) self.tree.grid(column=0, row=0, sticky='nsew', in_=container) vsb.grid(column=1, row=0, sticky='ns', in_=container) hsb.grid(column=0, row=1, sticky='ew', in_=container) container.grid_columnconfigure(0, weight=1) container.grid_rowconfigure(0, weight=1)
def scroll(view, vert=True, horiz=True, resize=True): kw = dict() if resize: if not horiz: kw.update(rowspan=2) if not vert: kw.update(colspan=2) view.grid(sticky=(tkinter.EW, tkinter.NS), **kw) view.master.rowconfigure(0, weight=1) view.master.columnconfigure(0, weight=1) if vert: scroll = Scrollbar(view.master, orient=tkinter.VERTICAL, command=view.yview) scroll.grid(row=0, column=1, sticky=(tkinter.W, tkinter.NS)) view.configure(yscrollcommand=scroll.set) if horiz: scroll = Scrollbar(view.master, orient=tkinter.HORIZONTAL, command=view.xview) scroll.grid(row=1, column=0, sticky=(tkinter.N, tkinter.EW)) view.configure(xscrollcommand=scroll.set) if resize: resize = Sizegrip(view.master) resize.grid(row=1, column=1, sticky=(tkinter.EW, tkinter.NS))
def _setup_widgets(self): s = "Corona-Scraper" msg = Label(wraplength="4i", justify="left", anchor="n", padding=(10, 2, 10, 6), text=s) msg.pack(fill='x') topf = Frame() topf.pack(pady=10) refreshb = Button(topf, text="Refresh", command=refreshData) refreshb.pack(side=LEFT, padx=10) global modeb, themeb modeb = Button(topf, text="Widget Mode", command=changeMode) modeb.pack(side=LEFT, padx=10) themeb = Button(topf, text="Dark Mode", command=changeTheme) themeb.pack(side=LEFT, padx=10) exitb = Button(topf, text="Exit", command=exitAppGui) exitb.pack(side=RIGHT, padx=10) container = Frame() container.pack(fill='both', expand=True) # create a treeview with dual scrollbars self.tree = Treeview(columns=country_header, show="headings") vsb = Scrollbar(orient="vertical", command=self.tree.yview) hsb = Scrollbar(orient="horizontal", command=self.tree.xview) self.tree.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set) self.tree.grid(column=0, row=0, sticky='nsew', in_=container) vsb.grid(column=1, row=0, sticky='ns', in_=container) hsb.grid(column=0, row=1, sticky='ew', in_=container) container.grid_columnconfigure(0, weight=1) container.grid_rowconfigure(0, weight=1)
def __init__(self, master, **opts): if 'yscrollincrement' not in opts: opts['yscrollincrement'] = 17 self.master = master self.frame = Frame(master) self.frame.rowconfigure(0, weight=1) self.frame.columnconfigure(0, weight=1) self.canvas = Canvas(self.frame, **opts) self.canvas.grid(row=0, column=0, sticky="nsew") self.vbar = Scrollbar(self.frame, name="vbar") self.vbar.grid(row=0, column=1, sticky="nse") self.hbar = Scrollbar(self.frame, name="hbar", orient="horizontal") self.hbar.grid(row=1, column=0, sticky="ews") self.canvas['yscrollcommand'] = self.vbar.set self.vbar['command'] = self.canvas.yview self.canvas['xscrollcommand'] = self.hbar.set self.hbar['command'] = self.canvas.xview self.canvas.bind("<Key-Prior>", self.page_up) self.canvas.bind("<Key-Next>", self.page_down) self.canvas.bind("<Key-Up>", self.unit_up) self.canvas.bind("<Key-Down>", self.unit_down) self.canvas.bind("<MouseWheel>", wheel_event) self.canvas.bind("<Button-4>", wheel_event) self.canvas.bind("<Button-5>", wheel_event) #if isinstance(master, Toplevel) or isinstance(master, Tk): self.canvas.bind("<Alt-Key-2>", self.zoom_height) self.canvas.focus_set()
def init_s3_tree(self): self.ex_s3_tree = Treeview(self.master) self.ex_s3_tree.column('#0', minwidth=500, stretch=0) self.ex_s3_tree.heading('#0', text=self.drp_sel, anchor='w') ysb = Scrollbar(self.master, orient='vertical', command=self.ex_s3_tree.yview) xsb = Scrollbar(self.master, orient='horizontal', command=self.ex_s3_tree.xview) self.ex_s3_tree.configure(yscroll=ysb.set, xscroll=xsb.set) n1 = "%s files found" % str(self.ex_s3_tree.size()) self.ex_s3_tree.grid(row=4, sticky=E, padx=100) self.set_found_s3_label(n1) self.ex_s3_tree.bind("<ButtonRelease-1>", lambda event, tv_obj=self.ex_s3_tree, s3=True: self.treeviewClick(event, tv_obj, s3)) self.build_s3_tree() self.ex_s3_tree.grid(row=0, column=0) ysb.grid(row=0, column=1, sticky='ns') xsb.grid(row=1, column=0, sticky='ew') self.master.grid()
def _create_treeview_tab(self, nb): # Populate the second pane. Note that the content doesn't really matter tree = None self.backg = ["white", '#f0f0ff'] tree_columns = ("country", "capital", "currency") tree_data = [("Argentina", "Buenos Aires", "ARS"), ("Australia", "Canberra", "AUD"), ("Brazil", "Brazilia", "BRL"), ("Canada", "Ottawa", "CAD"), ("China", "Beijing", "CNY"), ("France", "Paris", "EUR"), ("Germany", "Berlin", "EUR"), ("India", "New Delhi", "INR"), ("Italy", "Rome", "EUR"), ("Japan", "Tokyo", "JPY"), ("Mexico", "Mexico City", "MXN"), ("Russia", "Moscow", "RUB"), ("South Africa", "Pretoria", "ZAR"), ("United Kingdom", "London", "GBP"), ("United States", "Washington, D.C.", "USD")] container = Frame(nb) container.pack(fill='both', expand=False) self.tree = Treeview(container, columns=tree_columns, show="headings") vsb = Scrollbar(container, orient="vertical", command=self.tree.yview) hsb = Scrollbar(container, orient="horizontal", command=self.tree.xview) self.tree.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set) self.tree.grid(column=0, row=0, sticky='ns', in_=container) vsb.grid(column=1, row=0, sticky='ns', in_=container) hsb.grid(column=0, row=1, sticky='ew', in_=container) container.grid_columnconfigure(0, weight=1) container.grid_rowconfigure(0, weight=1) for col in tree_columns: self.tree.heading( col, text=col.title(), command=lambda c=col: self.sortby(self.tree, c, 0)) # XXX tkFont.Font().measure expected args are incorrect according # to the Tk docs self.tree.column(col, width=Font().measure(col.title()), stretch=False) for ix, item in enumerate(tree_data): itemID = self.tree.insert('', 'end', values=item) self.tree.item(itemID, tags=itemID) self.tree.tag_configure(itemID, background=self.backg[ix % 2]) # adjust columns lengths if necessary for indx, val in enumerate(item): ilen = Font().measure(val) if self.tree.column(tree_columns[indx], width=None) < ilen: self.tree.column(tree_columns[indx], width=ilen) sg = Sizegrip(container) sg.grid(sticky='e') nb.add(container, text='Treeview', underline=0, padding=2)
def startUI(self): self.root = Tk() self.root.title('Decryptor') self.root.columnconfigure(0, weight=1) self.root.rowconfigure(0, weight=1) mainFrame = Frame(self.root) mainFrame.grid(row=0, column=0, padx=5, pady=5, sticky='nswe') mainFrame.rowconfigure(1, weight=1) mainFrame.columnconfigure(0, weight=1) optionsFrame = Frame(mainFrame) optionsFrame.grid(row=0, column=0, pady=(5,0), sticky='nswe') optionsFrame.columnconfigure(0, pad=5) optionsFrame.columnconfigure(1, weight=1) optionsFrame.columnconfigure(2, pad=5) browserFrame = Frame(mainFrame) browserFrame.grid(row=1, column=0, pady=(5,0), sticky='nswe') browserFrame.rowconfigure(0, weight=1) browserFrame.columnconfigure(0, weight=1) actionFrame = Frame(mainFrame) actionFrame.grid(row=2, column=0, pady=(5,0), sticky='e') actionFrame.columnconfigure(0, weight=1) Label(optionsFrame, text="Secret").grid(row=0, column=0, sticky='w') self.secret = Entry(optionsFrame) self.secret.grid(row=0, column=1, sticky='nswe') self.secret.focus_set() self.secretToggleButton = Button(optionsFrame, text="Set", command=self.toggleSecret, width=8) self.secretToggleButton.grid(row=0, column=2, sticky='e') self.secretToggleButton.setvar('set', False) Label(optionsFrame, text="Encrypted Folder").grid(row=1, column=0, sticky='w') self.folderPath = Entry(optionsFrame, state='readonly') self.browseButton = Button(optionsFrame, text="Browse", command=self.chooseFolder, width=8) self.browseButton.grid(row=1, column=2, sticky='e') self.browseButton.configure(state='disabled') self.folderPath.grid(row=1, column=1, sticky='nswe') fileBrowserColumns = ('size', 'modified', 'encrypted name') self.fileBrowser = Treeview(browserFrame, columns=fileBrowserColumns) self.fileBrowser.heading('#0', text='File') for i in range(0, len(fileBrowserColumns)): self.fileBrowser.heading('#{0}'.format(i+1), text=fileBrowserColumns[i].title()) self.fileBrowser.grid(row=0, column=0, sticky='nswe') scrollBarY = Scrollbar(orient=VERTICAL, command=self.fileBrowser.yview) scrollBarX = Scrollbar(orient=HORIZONTAL, command=self.fileBrowser.xview) self.fileBrowser['yscroll'] = scrollBarY.set self.fileBrowser['xscroll'] = scrollBarX.set scrollBarY.grid(in_=browserFrame, row=0, column=1, sticky='ns') scrollBarX.grid(in_=browserFrame, row=1, column=0, sticky='ew') Button(actionFrame, text="Decrypt Selected", command=self.decryptSelected).grid(row=0, column=0) Button(actionFrame, text="Decrypt All", command=self.decryptAll).grid(row=0, column=1) self.root.mainloop()
def setup(self, tree_columns, tree_data): """Create Treeview widget Parameters ---------- tree_columns : str list of column names tree_data : str, int, float list of tree data Returns ------- None """ # create Treeview widget tree =self.tree = Treeview(self.fr0, column=tree_columns, show='headings',style='font.Treeview') tree.grid(column=0, row=0, sticky='nsew') tree.bind("<<TreeviewSelect>>", self.select_item) vsb = Scrollbar(self.fr0,orient="vertical", command=tree.yview) vsb.grid(column=1, row=0, sticky='ns') hsb = Scrollbar(self.fr0,orient="horizontal", command=tree.xview) hsb.grid(column=0, row=1, sticky='ew') tree.configure(xscrollcommand=hsb.set,yscrollcommand=vsb.set) self.fr0.grid_columnconfigure(0, weight=1) self.fr0.grid_rowconfigure(0, weight=1) # insert header, data and tag configuration for ix,col in enumerate(tree_columns): tree.heading(col, text=col.title(), command=lambda c=col: self.sort_by(tree, c, 0)) #tree.column(col,stretch=True) #tree.column(col,width=font.nametofont('TkHeadingFont').measure(col.title()), #stretch=False) tree.column(col,width=font.Font(family=self.font_family,size=self.font_size, weight="bold").measure(col.title()) + 10, stretch=False) #print(tree.column(col)) # insert data row by row, then measure each items' width for ix, item in enumerate(tree_data): item_ID = tree.insert('', 'end', values=item) tree.item(item_ID, tags=item_ID) tree.tag_configure(item_ID, background=self.backg[ix%2]) for indx, val in enumerate(item): #ilen = font.Font(family="Segoe UI", size=10, weight="normal").measure(val) ilen = font.nametofont('TkDefaultFont').measure(val) if tree.column(tree_columns[indx], width=None) < ilen +10: tree.column(tree_columns[indx], width=ilen + 10) # you should see the widths adjust #print('col',tree.column(tree_columns[indx]),ilen) # display selection self.lvar = StringVar() lbl = Label(self.fr0, textvariable=self.lvar, text="Ready") lbl.grid(column=0, row=2, sticky='nsew')
def _create_widgets(self): self.table_frame = Frame(self) self.scrollable_canvas = Canvas(self.table_frame) self.x_scroll = Scrollbar( self, orient=HORIZONTAL, command=self.scrollable_canvas.xview) self.y_scroll = Scrollbar( self.table_frame, orient=VERTICAL, command=self.scrollable_canvas.yview) self.scrollable_canvas.configure(yscrollcommand=self.y_scroll.set, xscrollcommand=self.x_scroll.set) self.table = Frame(self.scrollable_canvas)
def __init__(self, root): self.root = root # membuat label untuk memasukkan nama link Label(self.root, text="Masukkan Nama Link : ").place(x=10, y=10) application.layout.txt_nama = Entry(self.root) application.layout.txt_nama.place(x=10, y=30) # membuat label untuk memasukkan link Label(self.root, text="Masukkan Link yang akan di simpan : ").place(x=10, y=60) application.layout.txt_link = Entry(self.root) application.layout.txt_link['width'] = 34 application.layout.txt_link.place(x=10, y=80) # membuat kolom untuk memasukkan deskripsi Label(self.root, text="Masukkan deskripsi link : ").place(x=10, y=110) application.layout.txt_deskripsi = Entry(self.root) application.layout.txt_deskripsi['width'] = 34 application.layout.txt_deskripsi.place(x=10, y=130) # membuat fungsi untuk menangani keypress dari user application.layout.txt_deskripsi.bind('<Key>', application.commad().key_press) # menampilakn table Label(self.root, text="Daftar Link yang Sudah tersimpan : ").place(x=310, y=10) application.layout.table = Treeview(self.root, columns=('nama', 'link', 'deskripsi'), height=11) application.layout.table.place(x=300, y=30) ybs = Scrollbar(self.root, orient='vertical', command=application.layout.table.yview) application.layout.table.configure(yscroll=ybs.set) ybs.place(x=971, y=30, height=241) xbs = Scrollbar(self.root, orient='horizontal', command=application.layout.table.xview) application.layout.table.configure(xscroll=xbs.set) xbs.place(x=300, y=271, width=672) application.layout.table.heading('#0', text='Id') application.layout.table.column('#0', width=40, minwidth=40) application.layout.table.heading('nama', text='Nama') application.layout.table.column('nama', width=150, minwidth=150) application.layout.table.heading('link', text='Link') application.layout.table.column('link', width=240, minwidth=240) application.layout.table.heading('deskripsi', text='Deskripsi') application.layout.table.column('deskripsi', width=240, minwidth=240) application.layout.table.bind('<Double-1>', application.commad().select_table, add='+') # membuat button untuk eksekusi Button(self.root, text="Simpan Link", command=application.commad().save_link).place(x=90, y=165) Button(self.root, text="Cek select", command=application.commad().select_table).place(x=90, y=195)
def progress( self ): o=os.popen("cd {0} && snakemake --dryrun --rerun-incomplete > {0}/Reports/checkpoint".format(self.workpath.get())) o.close() F=open("{0}/Reports/checkpoint".format(self.workpath.get()),"r").read() rules2={} rules=re.findall(r'rule .+:',F) for i in rules: i=re.sub("rule ","",i) i=re.sub(":","",i) rules2[i]=0 F=open("{0}/Reports/{1}.dot".format(self.workpath.get(), self.Pipeline.get() ),"r").read() for i in rules2.keys(): F=re.sub(r'('+i+')(\".+?)\".+?\"',r'\1_pending\2"0.0 0.0 0.0"',F) # F=re.sub(i,"",F) G=open("{0}/Reports/{1}-{2}.dot".format(self.workpath.get(),self.Pipeline.get(),"progress"),"w") G.write(F) G.close() o=os.popen("cd {0}/Reports && dot -Tpng -o {0}/Reports/{1}-progress.png {0}/Reports/{1}-progress.dot;convert {0}/Reports/{1}-progress.png {0}/Reports/{1}-progress.gif".format(self.workpath.get(),self.Pipeline.get())) # tkinter.messagebox.showerror("o",o) PL=self.Pipeline.get() #pipelineget() gf=Toplevel() gf.title("CCBR Pipeliner: {0} Progress Graph".format(PL)) cgf = Canvas(gf,bg="white") # gff=Frame(cgf,width=300,height=300) xscrollbar = Scrollbar(gf, orient=HORIZONTAL) xscrollbar.pack(side = BOTTOM, fill=X ) xscrollbar.config(command=cgf.xview) yscrollbar = Scrollbar(gf,orient=VERTICAL) yscrollbar.pack(side = RIGHT, fill=Y ) yscrollbar.config(command=cgf.yview) cgf.config(xscrollcommand=xscrollbar.set, yscrollcommand=yscrollbar.set) cgf.config(width=600,height=600) cgf.pack(expand=1,fill=BOTH,side=RIGHT) cgf.config(scrollregion=(0,0,1000,5000)) try: time.sleep(5) img = PhotoImage(file="{0}/Reports/{1}-progress.gif".format(self.workpath.get(),PL)) except: time.sleep(5) img = PhotoImage(file="{0}/Reports/{1}-progress.gif".format(self.workpath.get(),PL)) cgf.create_image(0,0,image=img, anchor="nw") cgf.image=img
def __init__(self,root): self.root = root self.root.config(bg="#2c2f33") self.root.title("Portal") self.root.geometry("1220x720") self.root.iconbitmap('Medical-Management/icone.ico') self.root.resizable(0, 0) #============================================================================================================= self.frame_left = Frame(self.root, width=260, height=720, bg="#23272a").place(x=0,y=0) self.clck = Label(self.root,text="",font='Helvetica 14',fg="white",bg="#1e2124") self.clck.place(x=0, y=20,width=260,height=30) self.update_clock() self.label3 = Label(root, text='All work by mr-p-oliveira (⌐■_■), 2021',font='Helvetica 7', fg="#D0D3D4",bg="#1e2124").place(x=0 ,y=700, width=260, height=22) self.label2 = Label(root,font='Helvetica 7', fg="#D0D3D4",bg="#1e2124").place(x=260 ,y=700, width=960, height=22) self.label = Label(root, text='Selected',font='Helvetica 8', fg="#D0D3D4",bg="#1e2124").place(x=0,y=87,width=260,height=13) self.lf_lbl = Label(root,text="Search",font='Helvetica 12',fg="white", bg="#005042").place(x=0,y=100,width=260,height=55) #======================================================================================================================= i = 0 db.connect() self.tree = Treeview(root,columns=("firstnam" , "lastnam" , "gender", "birthdate", "adress", "city", "zipcod", "phone", "email", "sscnumber", "nhsnumber", "blood", "martial","weight","height","allerg", "doctor"),show='headings', selectmode="extended") self.tree.place(x=295,y=70,height=450,width=900) headings=('First name','Last name','Gender','Birthdate','Adress','City','Zipcode', 'Phone','Email','Social','NHS','Blood','Martial status','Weight','Height','Allergies','Doctor') sq2l = ("SELECT * FROM pat_reg") db_cursor.execute(sq2l) for j in range(len(headings)): self.tree.column(j,minwidth=100,width=120, stretch=0, anchor=CENTER) self.tree.heading(j,text=headings[j]) for ro in db_cursor: self.tree.insert('', i, text="",values=(ro[1], ro[2], ro[3], ro[4], ro[5], ro[6], ro[7], ro[8], ro[9], ro[10], ro[11], ro[12], ro[13], ro[14], ro[15], ro[16], ro[17])) i+=1 db.close() self.vscroll = Scrollbar(root,orient=VERTICAL,command=self.tree.yview) self.vscroll.place(x=1195,y=70,height=450) self.hscroll = Scrollbar(root,orient=HORIZONTAL,command=self.tree.xview) self.hscroll.place(x=295,y=500,width=900) self.tree.configure(xscrollcommand=self.hscroll.set,yscrollcommand=self.vscroll.set) #======================================================================================================================= self.but_ex = Button(root,text="Exit",font='Helvetica 7',width=10,fg="white", bg="#2c2f33",relief='flat',command=self.ExitApp).place(x=1150,y=700) self.bck_btn = Button(root,text="Back",font='Helvetica 12',width=12,fg="white", bg="#005042",command=self.back_win).place(x=1050,y=650)
def __init__(self, master, items, message, accept_func): self.accept_func = accept_func self.top = Toplevel(master) self.top.transient(master) self.top.rowconfigure(0, weight=1) self.top.rowconfigure(1, weight=3) self.top.rowconfigure(2, weight=0) self.top.columnconfigure(0, weight=1) self.top.columnconfigure(1, weight=1) self.top.resizable(width=True, height=True) self.frame = Frame(self.top) self.frame.rowconfigure(0, weight=1) self.frame.rowconfigure(1, weight=0) self.frame.columnconfigure(0, weight=1) self.frame.columnconfigure(1, weight=0) self.frame.grid(row=0, column=0, sticky=(N, S, W, E), columnspan=2) self.canvas = Canvas(self.frame) self.canvas.create_text(0, 0, text=message, anchor=NW) self.canvas.grid(row=0, column=0, sticky=(N, W, S, E)) self.vscroll = Scrollbar(self.frame, command=self.canvas.yview) self.vscroll.grid(row=0, column=1, sticky=(N, S)) self.canvas['yscrollcommand'] = self.vscroll.set self.hscroll = Scrollbar(self.frame, command=self.canvas.xview, orient=HORIZONTAL) self.hscroll.grid(row=1, column=0, sticky=(W, E), columnspan=2) self.canvas['xscrollcommand'] = self.hscroll.set self.canvas['scrollregion'] = self.canvas.bbox('all') self.canvas.bind('<Button-4>', self.scroll) self.canvas.bind('<Button-5>', self.scroll) self.canvas.bind('<MouseWheel>', self.scroll) self.view = NameView(self.top, sorted(items)) self.view.widget.grid(row=1, column=0, columnspan=2, sticky=(N, W, E, S)) self.delbutton = Button(self.top, text='Ok', command=self.accept) self.cancelbutton = Button(self.top, text='Cancel', command=self.cancel) self.delbutton.grid(row=2, column=0) self.cancelbutton.grid(row=2, column=1) self.view.widget.focus_set()
def _add_scrollbars(self): for orient in self.scrollbars: if orient == 'x': xsb = Scrollbar(self.master, orient=HORIZONTAL, command=self.xview) xsb.pack(side=BOTTOM, fill=X) self.configure(xscroll=xsb.set) if orient == 'y': ysb = Scrollbar(self.master, orient=VERTICAL, command=self.yview) ysb.pack(side=RIGHT, fill=Y) self.configure(yscroll=ysb.set)
def __init__(self, basis): super().__init__(basis) self.frmView = Frame(self.frmTab) self.tv = Treeview(self.frmView, selectmode='browse') scrVer = Scrollbar(self.frmView) scrHor = Scrollbar(self.frmView, orient='hor') scrVer['command'] = self.tv.yview scrHor['command'] = self.tv.xview self.tv['yscrollcommand'] = scrVer.set self.tv['xscrollcommand'] = scrHor.set self.frmView.grid_rowconfigure(0, weight=1) self.frmView.grid_columnconfigure(0, weight=1) self.tv.grid(row=0, column=0, sticky='nesw') scrVer.grid(row=0, column=1, sticky='ns') scrHor.grid(row=1, column=0, sticky='we')
def __init__(self, master, cnf={}, **kw): super().__init__(master, cnf, **kw) self.grid_rowconfigure(0, weight=1) self.grid_columnconfigure(0, weight=1) self.contacts_tree = AutosizeTreeview(self) self.contacts_tree.heading("#0", text="Contacts") self.contacts_tree.grid(row=0, column=0, sticky="nsew") contacts_tree_xscroll = Scrollbar(self, orient="horizontal", command=self.contacts_tree.xview) contacts_tree_yscroll = Scrollbar(self, orient="vertical", command=self.contacts_tree.yview) contacts_tree_xscroll.grid(row=1, column=0, sticky="nsew") contacts_tree_yscroll.grid(row=0, column=1, sticky="nsew") self.contacts_tree.configure(xscroll=contacts_tree_xscroll.set, yscroll=contacts_tree_yscroll.set)
def __init__(self, master, *args, logobject=None, **kwargs): super().__init__(master, *args, columns=HEADERS, height=10, **kwargs) self.vsb = Scrollbar(self, orient="vertical", command=self.yview) self.vsb.pack(side='right', fill='y') self.hsb = Scrollbar(self, orient="horizontal", command=self.xview) self.hsb.pack(side='bottom', fill='x') self.config(yscrollcommand=self.vsb.set) self.config(xscrollcommand=self.hsb.set) self['show'] = 'headings' for col in HEADERS: self.heading(col, text=col.title(), command=lambda c=col: self.sortby(c, 0)) self.column(col, width=50)
def __init__(self, parent, manager): """ CsvFrame constructor """ top = self.top = tkinter.Toplevel(parent) self.__parent = parent self.__manager = manager top_frame = tkinter.Frame(top, borderwidth=2, relief=tkinter.GROOVE) top_frame.pack(side=tkinter.TOP, fill=tkinter.X, padx=5, pady=5) label_data = Label(top_frame, text="Data: ") label_data.grid(row=1, column=1, padx=5, pady=5) data_select_combo3 = tkinter.StringVar() self.combo_data = Combobox(top_frame, textvariable=data_select_combo3, values=manager.get_field_names(), state='readonly', postcommand=lambda: self.combo_data.configure(values=manager.get_field_names())) self.combo_data.grid(row=1, column=2, padx=5, pady=5) edit_button = Button(top_frame, text="Edit header", command=self.edit_header, width=20) edit_button.grid(row=1, column=3, columnspan=1, rowspan=1, padx=5, pady=5) # TODO change values for combobox transform_select_combo4 = tkinter.StringVar() self.combo_transform = Combobox(top_frame, textvariable=transform_select_combo4, values=["rad_to_deg", "deg_to_rad"], state='readonly') self.combo_transform.grid(row=1, column=4, padx=5, pady=5) transform_button = Button(top_frame, text="Transform data", command=self.transform_data, width=20) transform_button.grid(row=1, column=5, columnspan=1, rowspan=1, padx=5, pady=5) table_frame = Frame(top) table_frame.pack(side=tkinter.BOTTOM, expand=True, fill=tkinter.BOTH) scrollbar_x = Scrollbar(table_frame, orient=tkinter.HORIZONTAL) scrollbar_y = Scrollbar(table_frame, orient=tkinter.VERTICAL) self.tree = Treeview(table_frame, columns=manager.get_field_names(), show="headings", selectmode="extended", yscrollcommand=scrollbar_y.set, xscrollcommand=scrollbar_x.set) scrollbar_y.config(command=self.tree.yview) scrollbar_y.pack(side=tkinter.RIGHT, fill=tkinter.Y) scrollbar_x.config(command=self.tree.xview) scrollbar_x.pack(side=tkinter.BOTTOM, fill=tkinter.X) self.fill_data() self.tree.pack(expand=True, fill=tkinter.BOTH) self.top.protocol("WM_DELETE_WINDOW", self.quit)
def build_tree(self): try: self.fr.destroy() except (NameError, AttributeError): pass self.fr = Frame(self.fra) self.fr.pack(fill='both', expand=False) #grid(column=0, row=1, sticky='nsew') lbl = Label(self.fr, text=self.csvFile) lbl.grid(column=0, row=0, sticky='n') self.tree = Treeview(self.fr, columns=self.treeColumns, show="headings", style='font.Treeview') # ,height =20 self.tree.grid(column=0, row=1, sticky='ns') vsb = Scrollbar(self.fr, orient="vertical", command=self.tree.yview) vsb.grid(column=1, row=1, sticky='ns') hsb = Scrollbar(self.fr, orient="horizontal", command=self.tree.xview) hsb.grid(column=0, row=2, sticky='ew') self.tree.configure(xscrollcommand=hsb.set, yscrollcommand=vsb.set) self.fr.grid_columnconfigure(0, weight=1) self.fr.grid_rowconfigure(0, weight=1) if self.renew: for row in self.tree.get_children(): self.tree.delete(row) for col in self.treeColumns: #print(treeColumns,col,col.title()) self.tree.heading(col, text=col.title()) self.tree.column( col, width=font.Font(family="Segoe UI", size=12, weight="bold").measure(col.title()) + 10, stretch=False) for ix, item in enumerate(self.treeData): self.tree.insert('', 'end', values=item) for indx, val in enumerate(item): ilen = font.nametofont('TkDefaultFont').measure(val) #*8//9 if self.tree.column(self.treeColumns[indx], width=None) < ilen + 10: self.tree.column(self.treeColumns[indx], width=ilen + 10)
def __init__(self, master, **options): # Create top frame, with scrollbar and listbox self.master = master self.frame = frame = Frame(master) self.frame.pack(fill="both", expand=1) self.vbar = vbar = Scrollbar(frame, name="vbar") self.vbar.pack(side="right", fill="y") self.listbox = listbox = Listbox(frame, exportselection=0, background="white") if options: listbox.configure(options) listbox.pack(expand=1, fill="both") # Tie listbox and scrollbar together vbar["command"] = listbox.yview listbox["yscrollcommand"] = vbar.set # Bind events to the list box listbox.bind("<ButtonRelease-1>", self.click_event) listbox.bind("<Double-ButtonRelease-1>", self.double_click_event) if macosx.isAquaTk(): listbox.bind("<ButtonPress-2>", self.popup_event) listbox.bind("<Control-Button-1>", self.popup_event) else: listbox.bind("<ButtonPress-3>", self.popup_event) listbox.bind("<Key-Up>", self.up_event) listbox.bind("<Key-Down>", self.down_event) # Mark as empty self.clear()
def __init__(self, parent, rawtext): """Create a frame for Textview. parent - parent widget for this frame rawtext - text to display """ super().__init__(parent) self['relief'] = 'sunken' self['height'] = 700 # TODO: get fg/bg from theme. self.bg = '#ffffff' self.fg = '#000000' self.text = text = Text(self, wrap='word', highlightthickness=0, fg=self.fg, bg=self.bg) self.scroll = scroll = Scrollbar(self, orient='vertical', takefocus=False, command=text.yview) text['yscrollcommand'] = scroll.set text.insert(0.0, rawtext) text['state'] = 'disabled' text.focus_set() scroll.pack(side='right', fill='y') text.pack(side='left', expand=True, fill='both')
def __init__(self, master, **kw): super().__init__(master, **kw) # Self configuration self.grid_columnconfigure(2, weight=1) self.grid_rowconfigure(1, weight=1) # Create a Canvas self.canvas = Canvas(self) self.canvas.grid(column=2, row=1, sticky='nwse') # Add a Scrollbar to the canvas self.scrollbar = Scrollbar(self, orient=VERTICAL, command=self.canvas.yview) self.scrollbar.grid(column=3, row=1, sticky='nwse') # Configure the canvas self.canvas.configure(yscrollcommand=self.scrollbar.set) self.canvas.bind('<Configure>', lambda e: self.canvas.configure(scrollregion=self.canvas.bbox('all'))) # Create Another frame inside the canvas where the tasks will be displayed self.second_frame = Frame(self.canvas) # Add that new frame to a window in the canvas self.canvas.create_window((0, 0), window=self.second_frame, anchor='nw') self.grid_stored_tasks()
def createWindow(self): self.window = Toplevel(self.app) self.window.title('Search') self.window.protocol("WM_DELETE_WINDOW", self.handleClose) self.input = Entry(self.window, textvariable=self.regex) self.input.grid(row=0, column=0) self.input.bind('<Return>', self.search) self.input.bind('<Escape>', lambda ev: self.window.focus()) self.searchButton = Button(self.window, text='Search', command=self.search, takefocus=0) self.searchButton.grid(row=0, column=1) self.resultCount = Label(self.window, text='0 results') self.resultCount.grid(row=0, column=2) cols = ('File', 'Tier', 'Time', 'Text') self.scroll = Scrollbar(self.window, orient='vertical') self.resultList = Treeview(self.window, columns=cols, show="headings", yscrollcommand=self.scroll.set, selectmode='browse') self.scroll.config(command=self.resultList.yview) for col in cols: self.resultList.heading(col, text=col) self.resultList.grid(row=2, column=0, columnspan=3, sticky='news') self.resultList.bind('<Double-1>', self.onClick) Grid.rowconfigure(self.window, 2, weight=1) Grid.columnconfigure(self.window, 0, weight=1) self.scroll.grid(row=2, column=3, sticky='ns')