def root_window(style='default'): window = tk.Tk() window.style = ttk.Style() if style in ttk.Style().theme_names(): window.style.theme_use(style) else: print("Style", style, "does not exist, using default.") window.style.theme_use('default') window.style.configure("TLabel", padding=6, font="Arial 12") window.style.configure("TButton", padding=6, font="Arial 12") return window
def __setup_styles(self): # custom ttk styles style = ttk.Style(self.master) arrow_layout = lambda dir: ( [('Button.focus', {'children': [('Button.%sarrow' % dir, None)]})] ) style.layout('L.TButton', arrow_layout('left')) style.layout('R.TButton', arrow_layout('right'))
def __init__(self): Tk.__init__(self) ttk.Style(self).configure('TButton', font=('Arial', 12), anchor=W) self.icp = PhotoImage(file='cadastrarpecas.png', master=self) self.icc = PhotoImage(file='cadastrarchapas.png', master=self) self.ico = PhotoImage(file='iconfiguracoes.png', master=self) self.ipc = PhotoImage(file='gerarplanocorte.png', master=self) self.botao1 = ttk.Button(self, text=' Cadastrar Peças', width=17, command=self.inserirpecas, image=self.icp, compound=LEFT) self.botao2 = ttk.Button(self, text=' Cadastrar Chapas', width=17, command=self.inserirchapas, image=self.icc, compound=LEFT) self.botao3 = ttk.Button(self, text=' Configurações', width=17, command=self.conf, image=self.ico, compound=LEFT) self.botao4 = ttk.Button(self, text=' Gerar Plano de Corte', width=17, command=self.plano, image=self.ipc, compound=LEFT) self.botao1.grid(row=0, column=0) self.botao2.grid(row=1, column=0) self.botao3.grid(row=2, column=0) self.botao4.grid(row=3, column=0) self.cpecas = sqlite3.connect('pecas.db') self.cp = self.cpecas.cursor() self.cp.execute( 'CREATE TABLE IF NOT EXISTS pecas (id text, comprimento real, largura real, quantidade real, area real)' ) self.cchapas = sqlite3.connect('chapas.db') self.cc = self.cchapas.cursor() self.cc.execute( 'CREATE TABLE IF NOT EXISTS chapas (id text, comprimento real, largura real, quantidade real, area real)' ) self.cconfig = sqlite3.connect('configuracoes.db') self.cco = self.cconfig.cursor() self.cco.execute( 'CREATE TABLE IF NOT EXISTS configuracoes (iteracoes int, alfa real, aprovmin real, tempo real, esp real)' )
def __init__(self): Tk.__init__(self) ttk.Style(self).configure('TButton', font=('Arial', 10)) self.lb1 = Label(self,text='Iterações',font=('Arial',10)) self.lb2 = Label(self,text='Alfa',font=('Arial',10)) self.lb3 = Label(self,text='Aproveitamento Mínimo (%)',font=('Arial',10)) self.lb4 = Label(self,text='Tempo Mínimo (min)',font=('Arial',10)) self.lb5 = Label(self,text='Espessura de Lâmina (mm)',font=('Arial',10)) self.lb6 = Label(self,text='Proporção inicial',font=('Arial',10)) self.lb7 = Label(self,text='Sensibilidade do scroll',font=('Arial',10)) self.lb1.grid(row=0,column=0) self.lb2.grid(row=1,column=0) self.lb3.grid(row=2,column=0) self.lb4.grid(row=3,column=0) self.lb5.grid(row=4,column=0) self.lb6.grid(row=5,column=0) self.lb7.grid(row=6,column=0) self.ent1 = Entry(self,width=10) self.ent2 = Entry(self,width=10) self.ent3 = Entry(self,width=10) self.ent4 = Entry(self,width=10) self.ent5 = Entry(self,width=10) self.ent6 = Entry(self,width=10) self.ent7 = Entry(self,width=10) self.ent1.grid(row=0,column=1) self.ent2.grid(row=1,column=1) self.ent3.grid(row=2,column=1) self.ent4.grid(row=3,column=1) self.ent5.grid(row=4,column=1) self.ent6.grid(row=5,column=1) self.ent7.grid(row=6,column=1) self.bt = ttk.Button(self,text='Salvar',command=self.save) self.bt.grid(row=7,column=0) self.cconfig = sqlite3.connect('configuracoes.db') self.cco = self.cconfig.cursor() self.cco.execute('CREATE TABLE IF NOT EXISTS configuracoes (iteracoes int, alfa real, aprovmin real, tempo real, esp real, count int, sens int)') for row in self.cco.execute('SELECT * FROM configuracoes'): self.ent1.insert('end',row[0]) self.ent2.insert('end',row[1]) self.ent3.insert('end',row[2]*100) self.ent4.insert('end',row[3]) self.ent5.insert('end',row[4]) self.ent6.insert('end',row[5]) self.ent7.insert('end',row[6])
def __init__(self, master): # formating window to have meaningful label and nice colours master.title('Silk Road Historic Feature Data Collection') master.configure(background = '#00000') # add in some window-universal styling self.style = ttk.Style() self.style.configure('TFrame', background = '#7387ed') self.style.configure('TButton', background = '#7387ed') self.style.configure('TLabelFrame', background = '#7387ed', font=('Arial', 12)) self.style.configure('TLabel', background = '#7387ed', font = ('Arial', 11)) self.style.configure('Header.TLabel', font = ('Arial', 18, 'bold')) # creating header frame and using pack geometry master to place at # top of window. This frame thanks user for contributing data. self.frame_header = ttk.Frame(master) self.frame_header.pack() ttk.Label(self.frame_header, text = "Thank you for sharing information about the Silk Road!", font = ('Arial', 14), background = '#7387ed').pack(pady=5) # creating a second frame in window - this time using the LabelFrame # constructor, so that the Location data being collected is made # distinct from other data types to avoid confusion about state (i.e., # want location and not current status). Using pack geometry manager to # add frame under header. self.frame_loc = ttk.Labelframe(master, text="Location of Historic Feature") self.frame_loc.pack() # creating labels for each of the location inputs ttk.Label(self.frame_loc, text = "City:").grid(row = 0, column = 0, pady = 3, sticky = 'sw') ttk.Label(self.frame_loc, text = "State:").grid(row = 2, column = 0, pady = 3, sticky = 'sw') ttk.Label(self.frame_loc, text = "Country:").grid(row = 4, column = 0, pady = 3, sticky = 'sw') # creating Entry widgets for user input of location info self.entry_city = ttk.Entry(self.frame_loc, width = 50, font = ('Arial', 11)) self.entry_state = ttk.Entry(self.frame_loc, width = 50, font = ('Arial', 11)) self.entry_country = ttk.Entry(self.frame_loc, width = 50, font =('Arial', 11)) # using grid geometry manager on entry widgets self.entry_city.grid(row = 1, column = 0) self.entry_state.grid(row = 3, column = 0) self.entry_country.grid(row = 5, column = 0) # creating another LabelFrame for Feature Detail section. Using pack # geometry mananger to add it under the Location frame. self.frame_details = ttk.Labelframe(master, text = "Feature Details") self.frame_details.pack() # creating Label widgets for each input ttk.Label(self.frame_details, text = "Name of Feature:").grid(row=0, column = 0, pady = 3, sticky = 'sw') ttk.Label(self.frame_details, text = "Type of Feature:").grid(row=2, column=0, pady = 3, sticky = 'sw') # creating widgets for feature details; name will be an Entry widget and # type will be a text widget to allow multi-line entry self.entry_name = ttk.Entry(self.frame_details, width = 60, font = ('Arial', 11)) self.text_type = Text(self.frame_details, width = 60, height = 10, font = ('Arial', 11)) # using grid geometry manager on feature detail widgets self.entry_name.grid(row = 1, column = 0) self.text_type.grid(row = 3, column = 0) # create buttons for Submit and Clear options. Submit sends data and # then the data is cleared from the fields ready for next entry. Clear # deletes all information from all fields. ttk.Button(self.frame_details, text = "Submit", command = self.submit).grid(row = 4, column = 0, pady=5) ttk.Button(self.frame_details, text = "Clear", command = self.clear).grid(row = 4, column = 1, pady=5)
def __init__(self, parent, title=None): self.lastValue = '' Tk.Frame.__init__(self, parent) self.parent = parent if title == None: title = "tk_vlc" self.parent.title(title) style = ttk.Style() style.configure("BW.TLabel", foreground="black", background="black") # The second panel holds controls self.player = None self.videopanel = ttk.Frame(self.parent, style="BW.TLabel") # self.videopanel.config(bg="black") self.canvas = Tk.Canvas(self.videopanel).pack(fill=Tk.BOTH, expand=1) self.videopanel.pack(fill=Tk.BOTH, expand=1) #frame = ttk.Frame(root, width=1000, height=1000) self.videopanel.bind("<Button-1>", self.pressedOne) self.videopanel.bind("<Double-Button-1>", self.pressedTwo) ctrlpanel = ttk.Frame(self.parent, style="BW.TLabel") pause = ttk.Button(ctrlpanel, text="Pause", command=self.OnPause) play = ttk.Button(ctrlpanel, text="Play", command=self.OnPlay) stop = ttk.Button(ctrlpanel, text="Stop", command=self.OnStop) load = ttk.Button(ctrlpanel, text="LoadMain", command=self.OnLoad) loadB = ttk.Button(ctrlpanel, text="LoadTemp", command=self.OnLoadB) self.blackFrame = ttk.Frame(self.parent, style="BW.TLabel") self.blackFrame.place(x=0, y=0, width=root.winfo_screenwidth(), height=root.winfo_screenheight()) self.blackFrame.bind("<Button-1>", self.pressedOne) # pause.pack(side=Tk.LEFT) # play.pack(side=Tk.LEFT) # stop.pack(side=Tk.LEFT) # load.pack(side=Tk.LEFT) loadB.pack(side=Tk.LEFT) ctrlpanel2 = ttk.Frame(self.parent, style="BW.TLabel") self.scale_var = Tk.DoubleVar() self.timeslider_last_val = "" self.timeslider = Tk.Scale(ctrlpanel2, variable=self.scale_var, command=self.scale_sel, from_=0, to=1000, orient=Tk.HORIZONTAL, length=500) self.timeslider.pack(side=Tk.BOTTOM, fill=Tk.X, expand=1) self.timeslider_last_update = time.time() # ctrlpanel.pack(side=Tk.BOTTOM) #ctrlpanel2.pack(side=Tk.BOTTOM, fill=Tk.X) # VLC player controls self.Instance = vlc.Instance('--no-xlib --verbose=0') self.player = self.Instance.media_player_new() self.player.audio_set_volume(100) self.player.video_set_scale(0) self.player.video_set_aspect_ratio('16:9') self.player.video_set_deinterlace('on') # self.player.set_fullscreen(True) # below is a test, now use the File->Open file menu media = self.Instance.media_new(video) self.player.set_media(media) # self.player.play() # hit the player button # self.player.video_set_deinterlace(str_to_bytes('yadif')) self.timer = ttkTimer(self.OnTimer, 0.5) self.timer.start() self.parent.update()
def __init__(self, parent, title=None, video=''): Tk.Frame.__init__(self, parent) self.compDataset = [] self.compComboOptions = ["Select Competition"] self.teamComboOptions = [] self.teamComboOptionsI = [] self.roundComboOptions = [] self.videoWt = 120 self.framesFound = 0 self.isSplitting = 0 style = ttk.Style() style.configure("TButton", padding=5, font=("Helvetica", "12")) style.configure("Player.TButton", pady=0, padx=0, font=("Helvetica", "12")) style.configure("Split.TButton", padx=5, pady=20, font=("Helvetica", "12")) style.configure("TProgressbar", pady=5) style.configure("SplitSelected.TButton", padding=5, background="green", activebackground="yellow", highlightbackground="yellow", font=("Helvetica", "20")) style.configure("Error.SplitSelected.TButton", padding=5, background="red", activebackground="red", highlightbackground="red", font=("Helvetica", "20")) self.parent = parent # == root self.parent.title(title or "Skydive Or Bust Dubbing 1.0") self.video = expanduser(video) # first, top panel shows vide self.vWrapper = ttk.Frame(self.parent) self.videopanel = ttk.Frame(self.vWrapper) self.canvas = Tk.Canvas(self.videopanel) self.canvas.pack(fill=Tk.BOTH, expand=1) self.videopanel.pack(fill=Tk.BOTH, expand=1) self.vWrapper.pack(side=Tk.LEFT) # panel to hold buttons self.buttons_panel = Tk.Frame(self.vWrapper) self.splitting_panel = Tk.Frame(self.parent) compcombo = ttk.Frame(self.buttons_panel) self.compCombo = ttk.Combobox(compcombo, width=25) self.compCombo['values'] = self.compComboOptions self.teamCombo = ttk.Combobox(compcombo, width=25) self.roundCombo = ttk.Combobox(compcombo, width=25) self.compCombo.pack(side=Tk.TOP) self.teamCombo.pack(side=Tk.TOP) self.roundCombo.pack(side=Tk.TOP) compcombo.pack(side=Tk.BOTTOM, fill=Tk.X) self.compCombo.bind('<<ComboboxSelected>>', lambda event: self.change_comp()) buttons = ttk.Frame(self.buttons_panel) self.openButton = ttk.Button(buttons, text="Open", command=self.OnOpen, style="Player.TButton") self.playButton = ttk.Button(buttons, text="Play", command=self.OnPlay, style="Player.TButton") stop = ttk.Button(buttons, text="Stop", command=self.OnStop, style="Player.TButton") eject = ttk.Button(buttons, text="Eject", command=self.OnEject, style="Player.TButton") self.slateButton = ttk.Button(self.splitting_panel, text="Slate", command=self.onMarkSlate, style="Split.TButton") self.exitButton = ttk.Button(self.splitting_panel, text="Exit", command=self.onMarkExit, style="Split.TButton") self.uploadButton = ttk.Button(self.splitting_panel, text="Upload", command=self.onUpload, style="Split.TButton") self.statusLabelH = ttk.Label(self.splitting_panel, text="Video Status:") self.progressBar = ttk.Progressbar(self.splitting_panel, orient=Tk.HORIZONTAL, length=200, mode='determinate', style="TProgressbar") self.wtLabel = ttk.Label(self.splitting_panel, text=str(self.videoWt) + "sec Working Time") self.statusLabel = ttk.Label(self.splitting_panel, text="Open Video") self.openButton.pack(side=Tk.LEFT) self.playButton.pack(side=Tk.LEFT) stop.pack(side=Tk.LEFT) eject.pack(side=Tk.LEFT) self.slateButton.pack(side=Tk.TOP) self.exitButton.pack(side=Tk.TOP) self.uploadButton.pack(side=Tk.TOP) self.statusLabelH.pack(side=Tk.TOP) self.progressBar.pack(side=Tk.TOP) self.wtLabel.pack(side=Tk.TOP) self.statusLabel.pack(side=Tk.TOP) buttons.pack(side=Tk.BOTTOM, fill=Tk.X) # panel to hold player time slider timers = ttk.Frame(self.buttons_panel) self.timeVar = Tk.DoubleVar() self.timeSliderLast = 0 self.timeSlider = Tk.Scale(timers, variable=self.timeVar, command=self.OnTime, from_=0, to=1000, orient=Tk.HORIZONTAL, length=400, showvalue=0) # label='Time', self.timeSlider.pack(side=Tk.BOTTOM, fill=Tk.X, expand=1) self.timeSliderUpdate = time.time() timers.pack(side=Tk.BOTTOM, fill=Tk.X) self.buttons_panel.pack(fill=Tk.BOTH, expand=1) self.splitting_panel.pack(fill=Tk.BOTH, expand=1) # VLC player args = [] args.append('--no-xlib') self.Instance = vlc.Instance(args) self.player = self.Instance.media_player_new() self.player.audio_set_volume(0) self.parent.bind("<Configure>", self.OnConfigure) # catch window resize, etc. self.parent.update() # After parent.update() otherwise panel is ignored. # self.buttons_panel.overrideredirect(True) # Estetic, to keep our video panel at least as wide as our buttons panel. # self.parent.minsize(width=600, height=450) self.is_buttons_panel_anchor_active = False # Download API Data self.get_comps() self.list_comps() self.OnTick() # set the timer up
def __init__(self, parent, title=None): global minDistance, isCached isCached = True self.lastValue = '' Tk.Frame.__init__(self, parent) self.parent = parent if title == None: title = "tk_vlc" self.parent.title(title) style = ttk.Style() style.configure("BW.TLabel", foreground="white", background="white") self.player = None self.videopanel = ttk.Frame(self.parent, style="BW.TLabel") self.canvas = Tk.Canvas(self.videopanel).pack(fill=Tk.BOTH, expand=1) self.videopanel.pack(fill=Tk.BOTH, expand=1) self.videopanel.bind("<Button-1>", self.pressedOne) self.videopanel.bind("<Button-3>", self.pressedRight) self.videopanel.bind("<Double-Button-1>", self.pressedTwo) ctrlpanel = ttk.Frame(self.parent, style="BW.TLabel") loadB = ttk.Button(ctrlpanel, text="LoadTemp", command=self.OnLoadB) self.blackFrame = ttk.Frame(self.parent, style="BW.TLabel") self.blackFrame.place(x=0, y=0, width=root.winfo_screenwidth(), height=root.winfo_screenheight()) # temp # self.blackFrame.place(x=6000) self.blackFrame.bind("<Button-1>", self.pressedOne) self.blackFrame.bind("<Button-3>", self.pressedRight) loadB.pack(side=Tk.LEFT) ctrlpanel2 = ttk.Frame(self.parent, style="BW.TLabel") self.scale_var = Tk.DoubleVar() self.timeslider_last_val = "" self.timeslider = Tk.Scale(ctrlpanel2, variable=self.scale_var, command=self.scale_sel, from_=0, to=1000, orient=Tk.HORIZONTAL, length=500) self.timeslider.pack(side=Tk.BOTTOM, fill=Tk.X, expand=1) self.timeslider_last_update = time.time() # VLC player controls # self.Instance = vlc.Instance('--no-xlib --verbose=0') self.Instance = vlc.Instance('--verbose=0') self.player = self.Instance.media_player_new() self.player.audio_set_volume(100) self.player.video_set_scale(0) # self.player.toggle_fullscreen() self.player.set_fullscreen(True) self.player.video_set_aspect_ratio('16:9') # var mediaOptions = new string[] {"input-repeat=-1"}; # self.player.SetMedia(new FileInfo(MediaFile), mediaOptions); # self.player.video_set_deinterlace('on') # below is a test, now use the File->Open file menu media = self.Instance.media_new(video) self.player.set_media(media) self.timer = ttkTimer(self.OnTimer, 1) self.timer.start() self.parent.update()
def __init__(self): Tk.__init__(self) ttk.Style(self).configure('TButton', font=('Arial', 10)) self.cpecas = sqlite3.connect('pecas.db') self.cp = self.cpecas.cursor() self.cp.execute( 'CREATE TABLE IF NOT EXISTS pecas (id text, comprimento real, largura real, quantidade real, area real)' ) self.label1 = Label(self, text='Id', font=('Arial', 10)) self.label2 = Label(self, text='Comprimento', font=('Arial', 10)) self.label3 = Label(self, text='Largura', font=('Arial', 10)) self.label4 = Label(self, text='Quantidade', font=('Arial', 10)) self.label5 = Label(self, text='Área', font=('Arial', 10)) self.label6 = Label(self, font=('Arial', 10)) self.label7 = Label(self, font=('Arial', 10)) self.label1.grid(row=0, column=0) self.label2.grid(row=0, column=1) self.label3.grid(row=0, column=2) self.label4.grid(row=0, column=3) self.label5.grid(row=0, column=4) self.label6.grid(row=4, column=0, columnspan=2, sticky=W) self.label7.grid(row=4, column=2, columnspan=2, sticky=W) self.br1 = Scrollbar(self, orient='vertical') self.br2 = Scrollbar(self, orient='horizontal') self.list1 = Listbox(self, yscrollcommand=self.yscroll1, width=15) self.list1.bind('<Button-3>', self.popup) self.list1.grid(row=2, column=0) self.list2 = Listbox(self, yscrollcommand=self.yscroll2, width=15) self.list2.bind('<Button-3>', self.popup) self.list2.grid(row=2, column=1) self.list3 = Listbox(self, yscrollcommand=self.yscroll3, width=15) self.list3.bind('<Button-3>', self.popup) self.list3.grid(row=2, column=2) self.list4 = Listbox(self, yscrollcommand=self.yscroll4, width=15) self.list4.bind('<Button-3>', self.popup) self.list4.grid(row=2, column=3) self.list5 = Listbox(self, yscrollcommand=self.yscroll5, width=15) self.list5.bind('<Button-3>', self.popup) self.list5.grid(row=2, column=4) y = 0 z = 0 for row in self.cp.execute('SELECT * FROM pecas'): self.list1.insert('end', row[0]) self.list2.insert('end', row[1]) self.list3.insert('end', row[2]) self.list4.insert('end', row[3]) self.list5.insert('end', round(row[4], 3)) y += row[3] z += (row[3] * row[4]) self.label6['text'] = (f'Quantidade: {int(y)}') self.label7['text'] = (f'M²: {round(z,3)}') y = 0 z = 0 self.br1.config(command=self.yview) self.br1.grid(row=2, column=5, sticky=N + S) self.br2.config(command=self.xview) self.br2.grid(row=3, column=0, sticky=W + E, columnspan=5) self.mc = Menu(self, tearoff=0) self.mc.add_command(label="Inserir Valores", command=self.inserir) self.mc.add_command(label="Excluir", command=self.excluirunit) self.bt1 = ttk.Button(self, text='Inserir', command=self.inserir) self.bt2 = ttk.Button(self, text='Excluir Tudo', command=self.excluir) self.bt3 = ttk.Button(self, text='Salvar', command=self.salvar) self.iex = PhotoImage(file='excel.png', master=self) self.bt4 = ttk.Button(self, image=self.iex, command=self.dialog) self.bt2.grid(row=2, column=6) self.bt1.grid(row=3, column=6) self.bt3.grid(row=4, column=6) self.bt4.grid(row=0, column=6, sticky=E)
gW8XKMgQOHABBQsMI76wIIOExo0FZIhM8sKGCQYCYA4cwcCEDSYPLOgg4Oro uhMEdOB84cCAChReB2ZQYcGGkxsGFGCgGzCFCh1QH5jQIW3xugwSzD4QvIIH 4s/PUgiQYcCG4BkC5P/ObpaBhwreq18nb3Z79+8Dwo9nL9I8evjWsdOX6D59 fPH71Xeef/kFyB93/sln4EP2Ebjegg31B5+CEDLUIH4PVqiQhOABqKFCF6qn 34cHcfjffCQaFOJtGaZYkIkUuljQigXK+CKCE3po40A0trgjjDru+EGPI/6I Y4co7kikkAMBmaSNSzL5gZNSDjkghkXaaGIBHjwpY4gThJeljFt2WSWYMQpZ 5pguUnClehS4tuMEDARQgH8FBMBBBExGwIGdAxywXAUBKHCZkAIoEEAFp33W QGl47ZgBAwZEwKigE1SQgAUCUDCXiwtQIIAFCTQwgaCrZeCABAzIleIGHDD/ oIAHGUznmXABGMABT4xpmBYBHGgAKGq1ZbppThgAG8EEAW61KwYMSOBAApdy pNp/BkhAAQLcEqCTt+ACJW645I5rLrgEeOsTBtwiQIEElRZg61sTNBBethSw CwEA/Pbr778ABywwABBAgAAG7xpAq6mGUUTdAPZ6YIACsRKAAbvtZqzxxhxn jDG3ybbKFHf36ZVYpuE5oIGhHMTqcqswvyxzzDS/HDMHEiiggQMLDxCZXh8k BnEBCQTggAUGGKCB0ktr0PTTTEfttNRQT22ABR4EkEABDXgnGUEn31ZABglE EEAAWaeN9tpqt832221HEEECW6M3wc+Hga3SBgtMODBABw00UEEBgxdO+OGG J4744oZzXUEDHQxwN7F5G7QRdXxPoPkAnHfu+eeghw665n1vIKhJBQUEADs=""") style = ttk.Style() style.element_create("RoundedFrame", "image", "frameBorder", ("focus", "frameFocusBorder"), border=16, sticky="nsew") style.layout("RoundedFrame", [("RoundedFrame", {"sticky": "nsew"})]) style.configure("TEntry", borderwidth=0) frame = ttk.Frame(style="RoundedFrame", padding=10) frame.pack(fill='x') frame2 = ttk.Frame(style="RoundedFrame", padding=10) frame2.pack(fill='both', expand=1) entry = ttk.Entry(frame) entry.pack(fill='x') entry.bind("<FocusIn>", lambda evt: frame.state(["focus"])) entry.bind("<FocusOut>", lambda evt: frame.state(["!focus"])) text = tk.Text(frame2, borderwidth=0, bg="white", highlightthickness=0) text.pack(fill='both', expand=1) text.bind("<FocusIn>", lambda evt: frame2.state(["focus"]))
def __init__(self, parent, title=None): global index,v2,v1 Tk.Frame.__init__(self, parent) self.parent = parent if title == None: title = "Intelligent Video Editor" self.parent.title(title) menubar = Tk.Menu(self.parent) self.parent.config(menu=menubar) fileMenu = Tk.Menu(menubar) fileMenu.add_command(label="Open", underline=0, command=self.OnOpen) fileMenu.add_command(label="Exit", underline=1, command=_quit) menubar.add_cascade(label="File", menu=fileMenu) self.player = None self.videopanel = ttk.Frame(self.parent) self.canvas = Tk.Canvas(self.videopanel).pack(fill=Tk.BOTH,expand=1) self.videopanel.pack(fill=Tk.BOTH,expand=1) ctrlpanel = ttk.Frame(self.parent) ctrlpanel1 = ttk.Frame(self.parent) ctrlpanel3 = ttk.Frame(self.parent) ctrlpanel2 = ttk.Frame(self.parent) ctrlpanel2.pack(side=BOTTOM,anchor=E) self.scale_var = Tk.DoubleVar() self.timeslider_last_val = "" self.timeslider = Tk.Scale(ctrlpanel, variable=self.scale_var, width=1.5,command=self.scale_sel,from_=0, to=1000, orient=Tk.HORIZONTAL, length=830) self.timeslider.pack(side=Tk.TOP, fill=Tk.X,expand=1) self.timeslider_last_update = time.time() style = ttk.Style() style.configure("TButton", foreground="white", background="blue") pause = Tk.Button(ctrlpanel, text=" Pause ", command=self.OnPause,bg="blue",fg="white",relief=RAISED,bd=5) screenshot = Tk.Button(ctrlpanel, text=" Screenshot ",bg="blue",fg="white",bd=5) plus5 = Tk.Button(ctrlpanel, text=" >> ", command=self.plus5,bg="blue",fg="white",bd=5) minus5 = Tk.Button(ctrlpanel, text=" << ", command=self.minus5,bg="blue",fg="white",bd=5) play = Tk.Button(ctrlpanel, text=" Play ", command=self.OnPlay,bg="blue",fg="white",bd=5) stop = Tk.Button(ctrlpanel, text=" Stop ", command=self.OnStop,bg="blue",fg="white",bd=5) Clip_Start = Tk.Button(ctrlpanel, text="Start Clip", command=self.OnClipStart, bg="green",fg="white",bd=5) Clip_Clear = Tk.Button(ctrlpanel3, text=" Clear", command=self.OnClipClear,bg="blue",fg="white",bd=5) edit = Tk.Button(ctrlpanel, text="/",width=4,bd=5) extraButton = Tk.Button(ctrlpanel, text="|||",command=self.task,width=4,bd=5 ) extraButton1 = Tk.Button(ctrlpanel, text="---",command=self.ScreenShot,width=3,bg="blue",fg="white",bd=5 ) v1 = StringVar() v2 = StringVar() S_Time = Entry(ctrlpanel3, textvariable=v1, width=9) S_Time.pack(side=LEFT,anchor=W) Clip_Clear.pack(side=LEFT, padx=(24,0)) max_lbl = Label(ctrlpanel3, text="Max").pack(side=LEFT,padx=(80,0)) self.volume_var = Tk.IntVar() self.volslider = Tk.Scale(ctrlpanel3, variable=self.volume_var,width=1.5, command=self.volume_sel,from_=0, to=100, orient=Tk.HORIZONTAL, length=200) self.volslider.pack(side=LEFT) min_lbl = Label(ctrlpanel3, text="Min").pack(side=LEFT) global filename_store,directory_store,fullname textBox=Text(ctrlpanel3, height=1, width=10) textBox.pack(side=LEFT,padx=(110,10)) text_buttonAdd = Button(ctrlpanel3, height=1, width=9, bg="blue",fg="white",bd=5, text="Add button", command=lambda:[Tk.Button(ctrlpanel2, text=textBox.get("1.0","end-1c"),height=1, width=9, bg="blue",fg="white",bd=5, command=lambda dummy=textBox.get("1.0","end-1c"): self.click_event(dummy)).pack(side="right",anchor=E),os.mkdir(directory_store+'/'+textBox.get("1.0","end-1c")),ButtonNames.append(textBox.get("1.0","end-1c"))]) text_buttonAdd.pack(side="left",padx=(0,0)) Clip_Start.pack(side=Tk.LEFT,padx=(0,5)) minus5.pack(side=Tk.LEFT,padx=(0,5)) play.pack(side=Tk.LEFT,padx=(0,0)) plus5.pack(side=Tk.LEFT,padx=(5,0)) pause.pack(side=Tk.LEFT,padx=(5,0)) stop.pack(side=Tk.LEFT,padx=(5,0)) screenshot.pack(side=Tk.LEFT,padx=(5,0)) edit.pack(side=Tk.LEFT,padx=(5,0)) extraButton1.pack(side=Tk.LEFT,padx=(5,0)) extraButton.pack(side=Tk.LEFT,padx=(5,0)) edit.pack(side=Tk.LEFT,padx=(5,0)) ctrlpanel2.pack(side=Tk.BOTTOM) ctrlpanel3.pack(side=Tk.BOTTOM) ctrlpanel.pack(side=Tk.BOTTOM) self.Instance = vlc.Instance() self.player = self.Instance.media_player_new() self.timer = ttkTimer(self.OnTimer, 1.0) self.timer.start() self.parent.update()