Example #1
0
 def RenameWindow(self, input_data):
     #print input_data
     try:
         self.tk
     except AttributeError:
         self.tk = TK.Tk()
         self.tk.iconbitmap(default= self.TKicon)
     self.tk.geometry('200x120')
     #TITLE
     self.tk.title('Rename')
     # COLOURS
     bgColour = '#2f2f2f'
     self.btnColour2 = '#098400'
     input_bgColour = '#cecece'
     input_fgColour = 'black'
     # POSITION
     pointer_x = self.tk.winfo_pointerx()
     pointer_y = self.tk.winfo_pointery()
     self.tk.geometry('+'+str(int(pointer_x))+'+'+str(pointer_y) )
     self.tk.resizable(width=FALSE, height=FALSE)
     # LABELS
     labelOffset = 25
     Name = Label(text = 'Name :', bg = bgColour, fg = 'white').place(x=8, y=5)
     scene = Label(text = 'Replace :', bg = bgColour, fg = 'white').place(x=8, y=5+labelOffset)
     shots = Label(text = 'With :', bg = bgColour, fg = 'white').place(x=8, y=30+labelOffset)
     ## INPUT FIELDS
     #
     self.name_field = Entry(bg = input_bgColour, fg=input_fgColour, bd = 0)
     self.replace_field = Entry(bg = input_bgColour, fg=input_fgColour, bd = 0)
     self.with_field = Entry(bg = input_bgColour, fg=input_fgColour, bd = 0)
     a= self.processFinalName(input_data)
     self.name_field.insert(0,a)
     #self.name_field.focus()
     # INPUT FIELD POSITION
     self.name_field.place(x=60, y= 8)
     self.replace_field.place(x=60, y= 8+labelOffset )
     self.with_field.place(x=60, y=33 + labelOffset )
     #
     # BUTTON OPTIONS
     renameBtn = Button(text = 'RENAME', bg = bgColour, fg = 'white', width = 200 , command = partial(self.rename_custom, input_data ) )  #partial(return self.name_field, self.replace_field, self.with_field) )
     # BUTTON POSITION
     renameBtn.pack(side = 'bottom' )
     #
     self.tk.configure(background= bgColour)
     self.tk.bind('<Escape>', quit) # BIND TO ESC KEY
     self.tk.bind('<Return>', partial(self.rename_custom, input_data ))
     #self.tk.bind("<FocusOut>", self.killWindow) 
     self.tk.mainloop()
     if Name.winfo_exists() == True:
         self.windowOpen = 1
     else: 
         self.windowOpen = 0