def frame_4_(): global frame_list frame_des() frame_4_1 = Notebook(frame, width=261, height=240) frame_4_1.place(x=10, y=63) frame_4_2 = Frame(frame_4_1) frame_4_3 = Frame(frame_4_1) frame_4_1.add(frame_4_2, text="One player", padding=2) frame_4_1.add(frame_4_3, text="Two player", padding=2) frame_4_8 = Scrollbar(frame_4_2) frame_4_8.pack(fill="y", side=RIGHT) frame_4_9 = Scrollbar(frame_4_3) frame_4_9.pack(fill="y", side=RIGHT) frame_4_6 = Text(frame_4_2, font='arial 14', width=24, height=11) frame_4_6.pack() frame_4_7 = Text(frame_4_3, font='arial 14', width=24, height=11) frame_4_7.pack() frame_4_8.config(command=frame_4_6.yview) frame_4_6.config(yscrollcommand=frame_4_8.set) frame_4_9.config(command=frame_4_7.yview) frame_4_7.config(yscrollcommand=frame_4_9.set) with open('data\\one player.txt', mode='r') as f: obj = f.read() frame_4_6.insert('end', obj) with open('data\\two player.txt', mode='r') as f: obj = f.read() frame_4_7.insert('end', obj) frame_4_6.config(state='disable') frame_4_7.config(state='disable') frame_4_10 = Label(frame, text='Score Board', bg='#01CBC6', fg='#000000', font='arial 22 bold underline') frame_4_10.place(x=20, y=335) frame_4_5 = Button(frame, image=image, relief='flat', bg='#01CBC6', fg='#000000', activebackground='#01CBC6', cursor='hand2', command=frame_1_) frame_4_5.place(x=220, y=335) frame_list = [ frame_4_6, frame_4_7, frame_4_2, frame_4_3, frame_4_1, frame_4_5, frame_4_10 ]
# Интенсивонсть потока обслуживания (U) Result_label = tk.Label(right_frame, text='Интенсивонсть потока обслуживания (U)') Result_label.place(relx=0.1, rely=0.65, width=350) Result_entry = tk.Entry(right_frame, textvariable=potokObsE) Result_entry.place(relx=0.7, rely=0.65) # Автор Result_label = tk.Label(right_frame, text='(c) Маштаков Кирилл ИС 3 курс', bg='#090909', fg='white') Result_label.place(relx=0.55, rely=0.95, width=350) button_mnogokanal_bez = tk.Button(left_frame_inside, text='Рассчитать', command=mnogokanal_SMO_bez, bg='#E50914', fg='white', font=MYFONT) button_mnogokanal_bez.place(relx=0.15, rely=0.8, relwidth=0.5, relheight=0.1) button_clear = tk.Button(left_frame_inside, text='Очистить', command=reset, font=MYFONT) button_clear.place(relx=0.65, rely=0.8, relheight=0.1, relwidth=0.22) tablayout.place(relx=0, rely=0, relwidth=1, relheight=1) root.mainloop()
class App(Tk): def __init__(self, *args, **kwargs): Tk.__init__(self, *args, **kwargs) self.hyp_folders = self.GenFolders() self.background_list = self.GenBGList() self.userPrefs = self.GenUserPrefs() self.SetupVars(self.background_list, self.hyp_folders, self.userPrefs) self.SetupMenu() self.SavePref() def SetupVars(self, background_list, hyp_folders, prefdict): self.p_hypno, self.c_hypno = Pipe() self.p_vid, self.c_vid = Pipe() self.p_pinup, self.c_pinup = Pipe() self.background_list = background_list self.background_select = StringVar(self) if len(background_list) < int(prefdict['background_select_var']): prefdict['background_select_var'] = 0 self.background_select_var = int(prefdict['background_select_var']) self.background_select.set(background_list[self.background_select_var]) self.width = self.winfo_screenwidth() self.height = self.winfo_screenheight() self.winWidth = 50 self.winHeight = 100 geo = '%dx%d+%d+%d' % (self.winWidth, self.winHeight, self.width - self.winWidth, self.height / 2 - self.winHeight / 2) self.overrideredirect(1) self.geometry(geo) self.hyp_delay = StringVar(self) self.hyp_delay.set(prefdict['hyp_delay']) self.hyp_opacity = StringVar(self) self.hyp_opacity.set(prefdict['hyp_opacity']) self.hyp_able = IntVar(self) self.hyp_able.set(int(prefdict['hyp_able'])) self.UseActionMenu = IntVar(self.master) self.UseActionMenu.set(int(prefdict['actionmenu'])) self.hyp_pinup = IntVar(self) self.hyp_pinup.set(int(prefdict['hyp_pinup'])) self.delold = IntVar(self) self.delold.set(int(prefdict['delold'])) self.UseHSBackground = IntVar(self) self.UseHSBackground.set(prefdict['UseHSBackground']) self.Old_UseHSBackground = int(prefdict['UseHSBackground']) if self.UseHSBackground.get() == 1: self.HandleOSBackground(1) self.Alphabet = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ] self.convfolder = StringVar(self) self.convfolder.set(' ') self.s_rulename = StringVar(self) self.s_rulename.set(prefdict['s_rulename']) self.hyp_gfile = StringVar(self) self.hyp_gfile_var = int(prefdict['hyp_gfile_var']) self.AllCharList = ['No Images'] self.hyp_folders = hyp_folders try: self.hyp_gfile.set(hyp_folders[self.hyp_gfile_var]) except IndexError: self.hyp_gfile.set(hyp_folders[0]) self.conv_hyp_folders = hyp_folders self.textwidth = StringVar() self.textwidth.set(self.width) self.textheight = StringVar() self.textheight.set(self.height) self.OverlayActive = False self.Editting = False self.RulesOkay = False self.ActionMenuOpen = False self.WSActive = False self.rulesets = [] Filepath = path.abspath('Resources/Games') for filename in iglob(Filepath + '/*/', recursive=True): filename = filename.split(Filepath)[-1].replace('\\', '') self.rulesets.append(filename) def LoadPreDict(self): Filepath = path.abspath('Resources/Games/' + self.s_rulename.get() + '/Preferences.txt') for i in glob(Filepath): self.ResetPrefDict(self.GenUserPrefs(i)) def GenUserPrefs(self, PrefFilePath='Resources/Preferences.txt'): try: with open(PrefFilePath, 'r') as f: lines = f.read().split('\n') prefdict = {} for line in lines: key, sep, value = line.partition(':') prefdict[key] = value except FileNotFoundError: prefdict = PREFDICT_PRESET return prefdict def ResetPrefDict(self, prefdict): print('resetting vars') self.background_select_var = int(prefdict['background_select_var']) self.background_select.set( self.background_list[self.background_select_var]) self.hyp_delay.set(prefdict['hyp_delay']) self.hyp_opacity.set(prefdict['hyp_opacity']) self.hyp_able.set(int(prefdict['hyp_able'])) self.hyp_pinup.set(int(prefdict['hyp_pinup'])) self.UseActionMenu.set(int(prefdict['actionmenu'])) self.delold.set(int(prefdict['delold'])) self.UseHSBackground.set(prefdict['UseHSBackground']) self.Old_UseHSBackground = int(prefdict['UseHSBackground']) self.s_rulename.set(prefdict['s_rulename']) self.hyp_gfile_var = int(prefdict['hyp_gfile_var']) def SetupMenu(self): def StartMoveMM(event): self.MMy = event.y self.MMx = event.x def StopMoveMM(event): self.MMy = None def MainMenuOnMotion(event): deltax = event.x - self.MMx deltay = event.y - self.MMy x = self.winfo_x() + deltax y = self.winfo_y() + deltay self.geometry("+%s+%s" % (x, y)) self.wm_attributes("-transparentcolor", 'white') self.wm_attributes("-topmost", 1) self.frame = Frame( self, width=1000, height=1000, #height=270, borderwidth=2, bg='white', relief=RAISED) self.frame.grid(row=0, column=0) self.bg = Label(self.frame, bg='gray40', width=5, height=30, anchor=E) self.bg.place(x=0, y=20) self.bg.grip = Label(self.frame, height=1, bg='Gray80', text="<Move>", font=('Times', 8)) self.bg.grip.place(x=0, y=0) self.bg.grip.bind("<ButtonPress-1>", StartMoveMM) self.bg.grip.bind("<ButtonRelease-1>", StopMoveMM) self.bg.grip.bind("<B1-Motion>", MainMenuOnMotion) self.BtnHypno = Button(self.bg, text="Start", width=5, command=self.LaunchHypno) self.BtnHypno.grid(row=1, column=0) self.BtnEdit = Button(self.bg, text="Edit", width=5, command=self.EditHypno) self.BtnEdit.grid(row=2, column=0) self.BtnQuit = Button(self.bg, text="Quit", width=5, command=self.Shutdown) self.BtnQuit.grid(row=3, column=0) self.config(takefocus=1) def LaunchHypno(self): try: if self.Editting == True: self.DestroyActions() if self.OverlayActive == False: self.BtnHypno.config(text='End') self.OverlayActive = True self.RulesOkay = False while self.c_hypno.poll() == True: self.c_hypno.recv() self.delay = int(self.hyp_delay.get()) self.opacity = int(self.hyp_opacity.get()) self.hypno = self.hyp_able.get() self.pinup = self.hyp_pinup.get() self.globfile = path.abspath(self.hyp_gfile.get()) self.s_rulename = self.s_rulename.get() self.gifset = self.background_select.get().replace('.gif', '') Hypno.launch(self.delay, self.opacity, self.OverlayActive, self.pinup, self.globfile, self.s_rulename, self.gifset, self.c_vid, self.c_pinup, self.c_hypno) self.EstablishRules() else: self.DestroyActions() except Exception as e: print(e) def EstablishRules(self): def GenButtonLines(rulefilename): Filepath = path.abspath('Resources/Games/' + rulefilename) with open(Filepath, 'r') as f: self.templines = f.readlines() if '.jpg' in self.templines[0].replace('\n', ''): icon = self.templines[0].replace('\n', '') self.templines.remove(self.templines[0]) else: icon = '' return icon, self.templines, cycle(self.templines) try: print("checking rules") if self.RulesOkay == False: print("rules ok") iterlist = [] print(self.UseActionMenu.get()) if self.UseActionMenu.get() == 1: print("Setting actions") try: FirstIconFound = False self.IconA, ActionListA, self.ActionCycleA = GenButtonLines( self.s_rulename.get() + '/ButtonA.txt') FirstIconFound = True iterlist.append(ActionListA) self.IconB, ActionListB, self.ActionCycleB = GenButtonLines( self.s_rulename.get() + '/ButtonB.txt') iterlist.append(ActionListB) self.IconC, ActionListC, self.ActionCycleC = GenButtonLines( self.s_rulename.get() + '/ButtonC.txt') iterlist.append(ActionListC) self.IconD, ActionListD, self.ActionCycleD = GenButtonLines( self.s_rulename.get() + '/ButtonD.txt') iterlist.append(ActionListD) self.IconE, ActionListE, self.ActionCycleE = GenButtonLines( self.s_rulename.get() + '/ButtonE.txt') iterlist.append(ActionListE) self.IconF, ActionListF, self.ActionCycleF = GenButtonLines( self.s_rulename.get() + '/ButtonF.txt') iterlist.append(ActionListF) self.IconG, ActionListG, self.ActionCycleG = GenButtonLines( self.s_rulename.get() + '/ButtonG.txt') iterlist.append(ActionListG) self.IconH, ActionListH, self.ActionCycleH = GenButtonLines( self.s_rulename.get() + '/ButtonH.txt') iterlist.append(ActionListH) self.IconI, ActionListI, self.ActionCycleI = GenButtonLines( self.s_rulename.get() + '/ButtonI.txt') iterlist.append(ActionListI) self.IconJ, ActionListJ, self.ActionCycleJ = GenButtonLines( self.s_rulename.get() + '/ButtonJ.txt') iterlist.append(ActionListJ) except FileNotFoundError as e: print(e) except Exception as e: print(e) self.RulesOkay = True self.BuildActionMenu() except Exception as e: print(e) def EditHypno(self): def UpdateEditMenu(): try: if self.Editting == True: if self.gifcanvas: self.gifcanvas.itemconfig(self.gifpreview, image=next(self.GifCycle)) if self.c_hypno.poll() == False: self.p_hypno.send(True) self.after(25, UpdateEditMenu) except AttributeError as e: print('Gif Preview failed.') print( 'Please configure the Width and Height and press Format Gifs ' ) except Exception as e: print(e) def CloseEditMenu(): try: self.Editting = False self.EditMenu.destroy() except Exception as e: print(e) try: if self.OverlayActive == False and self.Editting == False: self.Editting = True if self.c_hypno.poll() == True: self.c_hypno.recv() self.EditMenu = Toplevel() self.EditMenu.title("Settings") self.EditMenu.overrideredirect(False) width, height = 1200, 500 x = (self.width / 2) - (width / 2) y = (self.height / 2) - (height / 2) self.EditMenu.geometry('%dx%d+%d+%d' % (width, height, x, y)) self.note = Notebook(self.EditMenu) self.tab1 = Frame(self.note, width=width - 100, height=height - 100, borderwidth=0, relief=RAISED) self.SetupTab1() self.note.add(self.tab1, text="Background and Pinup") self.note.place(x=50, y=0) # Exit button Button(self.EditMenu, text="Save/Close", command=CloseEditMenu).place(x=width - 115, y=height - 65) self.after(25, UpdateEditMenu) else: if self.OverlayActive: self.after(25, self.EditHypno) self.DestroyActions() except Exception as e: print(e) def SetupTab1(self): def GenGifCycle(event=None): self.gifcyclist = [] i = self.background_select.get().replace('.gif', '').split('\\')[-1] Filepath = 'Resources/Gifs/' + i + '/*.gif' for myimage in sorted(glob(Filepath, recursive=True)): self.gifcyclist.append( ImageTk.PhotoImage( Image.open(myimage).resize((250, 250), Image.LANCZOS))) self.GifCycle = cycle(self.gifcyclist) def HandleImgConvert(): print('Converting Images...') folder = self.convfolder.get() if folder == 'All': for folder in self.hyp_folders: if not folder == 'All': self.ConvertImg(folder, self.delold.get(), self.width, self.height) else: self.ConvertImg(folder, self.delold.get(), self.width, self.height) print('Done.') def FormatGifs(): print('Formatting Gifs...') mywidth, myheight = int(self.textwidth.get()), int( self.textheight.get()) Filepath = path.abspath('Resources/Background Gif Original') self.ExtractFrames(mywidth, myheight, Filepath) self.background_list = self.GenBGList() print('Done.') # #Handle Gif# # self.handlegif = Canvas(self.tab1, bg='gray50', width=250, height=300) self.handlegif.place(x=15, y=5) OptionMenu(self.handlegif, self.background_select, *self.background_list, command=GenGifCycle).place(x=15, y=7) self.gifcanvas = Canvas(self.handlegif, width=250, height=250, bg='gray75') self.gifcanvas.place(x=0, y=50) GenGifCycle() try: self.gifpreview = self.gifcanvas.create_image(1, 1, image=next( self.GifCycle), anchor=NW) except StopIteration: Label(self.gifcanvas, width=25, font=('Times', 12), text='!Format Gif Before Running', anchor=W, bg='gray75').place(x=0, y=0) # #Format gif# # self.bggif = Label(self.tab1, bg='gray50', width=300) self.bggif.place(x=870, y=240) Label(self.bggif, width=6, font=('Times', 12), text='Width', anchor=W).grid(row=0, column=0, pady=2) Label(self.bggif, width=6, font=('Times', 12), text='Height', anchor=W).grid(row=1, column=0, pady=2) Entry(self.bggif, width=5, borderwidth=0, font=('Times', 14), textvariable=self.textwidth).grid(row=0, column=1) Entry(self.bggif, width=5, borderwidth=0, font=('Times', 14), textvariable=self.textheight).grid(row=1, column=1) Button(self.bggif, text="Format Gifs", command=FormatGifs).grid(row=1, column=2) # Convert png # self.bgConvert = Label(self.tab1, bg='gray50', width=30, height=4) self.bgConvert.place(x=500, y=240) Button(self.bgConvert, text="Convert jpg to png", command=HandleImgConvert).place(x=1, y=1) Checkbutton(self.bgConvert, text="Delete jpgs", variable=self.delold).place(x=138, y=2) OptionMenu(self.bgConvert, self.convfolder, *self.conv_hyp_folders).place(x=1, y=35) # ############ # Message(self.tab1, text='Overlay Opacity (0-100)').place(x=300, y=25) Message(self.tab1, text='Cycle Delay').place(x=300, y=75) Message(self.tab1, text='Image Folder').place(x=300, y=125) Entry(self.tab1, textvariable=self.hyp_opacity).place(x=400, y=30) OptionMenu(self.tab1, self.hyp_delay, '250', '500', '1000', '1500', '3000').place(x=400, y=75) OptionMenu(self.tab1, self.hyp_gfile, *self.hyp_folders).place(x=400, y=125) Radiobutton(self.tab1, text="None", variable=self.hyp_able, value=0).place(x=300, y=200) Radiobutton(self.tab1, text="Hypno Background", variable=self.hyp_able, value=1).place(x=300, y=225) Radiobutton(self.tab1, text="Turbo Hypno", variable=self.hyp_able, value=2).place(x=300, y=250) self.EnablePinups = Checkbutton(self.tab1, text="Enable Pinups", variable=self.hyp_pinup) self.EnablePinups.place(x=300, y=275) # has to be an object Checkbutton(self.tab1, text="Healslut Desktop Background", variable=self.UseHSBackground).place(x=800, y=50) Checkbutton(self.tab1, text="Use ActionMenu", variable=self.UseActionMenu).place(x=800, y=75) Message(self.tab1, text='Rule set').place(x=800, y=125) Button(self.tab1, text="Load Premade Rules", command=self.LoadPreDict).place(x=900, y=125) OptionMenu(self.tab1, self.s_rulename, *self.rulesets).place(x=800, y=150) def BuildActionMenu(self): def GenButtonImage(filename): Filepath = path.abspath('Resources\\Buttonlabels\\' + filename) tempphoto = Image.open(Filepath) tempphoto = tempphoto.resize((50, 50), Image.LANCZOS) return ImageTk.PhotoImage(tempphoto) def StartMoveAM(event): self.AMx, self.AMy = event.x, event.y def StopMoveAM(event): self.AMx, self.AMy = None, None def ActionMenuOnMotion(event): x = self.ActionMenu.winfo_x() + event.x - self.AMx y = self.ActionMenu.winfo_y() + event.y - self.AMy self.ActionMenu.geometry("+%s+%s" % (x, y)) if self.ActionMenuOpen == False and self.UseActionMenu.get() == 1: Filepath = path.abspath('Resources/Games/' + self.s_rulename.get() + '/ButtonA.txt') if path.isfile(Filepath): self.ActionMenuOpen = True self.ActionMenu = Toplevel(self, bg='white', highlightthickness=0) self.ActionMenu.overrideredirect(True) self.ActionMenu.wm_attributes("-topmost", 1) self.ActionMenu.wm_attributes("-transparentcolor", 'white') self.ActionFrame = Frame( self.ActionMenu, width=50, height=50, bg='white', borderwidth=0, relief=RAISED, ) self.ActionFrame.grid(row=0, column=0) # Movement grip self.grip = Label(self.ActionFrame, height=1, bg='Gray50', text="< Hold to Move >", font=('Times', 8)) self.grip.grid(row=0, column=0, columnspan=2) self.grip.bind("<ButtonPress-1>", StartMoveAM) self.grip.bind("<ButtonRelease-1>", StopMoveAM) self.grip.bind("<B1-Motion>", ActionMenuOnMotion) x = (self.width - 300) y = (self.height * .4) self.ActionMenu.geometry('%dx%d+%d+%d' % (115, 310, x, y)) try: self.imageA = GenButtonImage(self.IconA) print(self.IconA) self.ButtonA = Button(self.ActionFrame, image=self.imageA, text="A", command=partial( self.HandleCycles, self.ActionCycleA)).grid( row=1, column=0, sticky=W + E + N + S) self.imageB = GenButtonImage(self.IconB) self.ButtonB = Button(self.ActionFrame, image=self.imageB, text="A", command=partial( self.HandleCycles, self.ActionCycleB)).grid( row=1, column=1, sticky=W + E + N + S) self.imageC = GenButtonImage(self.IconC) self.ButtonC = Button(self.ActionFrame, image=self.imageC, text="A", command=partial( self.HandleCycles, self.ActionCycleC)).grid( row=2, column=0, sticky=W + E + N + S) self.imageD = GenButtonImage(self.IconD) self.ButtonD = Button(self.ActionFrame, image=self.imageD, text="A", command=partial( self.HandleCycles, self.ActionCycleD)).grid( row=2, column=1, sticky=W + E + N + S) self.imageE = GenButtonImage(self.IconE) self.ButtonE = Button(self.ActionFrame, image=self.imageE, text="A", command=partial( self.HandleCycles, self.ActionCycleE)).grid( row=3, column=0, sticky=W + E + N + S) self.imageF = GenButtonImage(self.IconF) self.ButtonF = Button(self.ActionFrame, image=self.imageF, text="A", command=partial( self.HandleCycles, self.ActionCycleF)).grid( row=3, column=1, sticky=W + E + N + S) self.imageG = GenButtonImage(self.IconG) self.ButtonG = Button(self.ActionFrame, image=self.imageG, text="A", command=partial( self.HandleCycles, self.ActionCycleG)).grid( row=4, column=0, sticky=W + E + N + S) self.imageH = GenButtonImage(self.IconH) self.ButtonH = Button(self.ActionFrame, image=self.imageH, text="A", command=partial( self.HandleCycles, self.ActionCycleH)).grid( row=4, column=1, sticky=W + E + N + S) self.imageI = GenButtonImage(self.IconI) self.ButtonI = Button(self.ActionFrame, image=self.imageI, text="A", command=partial( self.HandleCycles, self.ActionCycleI)).grid( row=5, column=0, sticky=W + E + N + S) self.imageJ = GenButtonImage(self.IconJ) self.ButtonJ = Button(self.ActionFrame, image=self.imageJ, text="A", command=partial( self.HandleCycles, self.ActionCycleJ)).grid( row=5, column=1, sticky=W + E + N + S) except Exception as e: pass def HandleCycles(self, mycycle): def do_macro(macro): if '$playvideo' in macro: file = macro.replace('$playvideo ', '') Filepath = path.abspath('Resources/Video/' + file) self.p_vid.send(Filepath) if '$pinup' in macro: Filepath = path.abspath('Resources/Images/' + macro.replace('$pinup ', '')) + '/' self.p_pinup.send(Filepath) try: cyc = next(mycycle) line = str(cyc).split(',') for macro in line: do_macro(macro.replace('\n', '')) except Exception as e: print(e) def GenFolders(self): hyp_folders = glob('Resources\\Images\\*\\', recursive=True) if len(hyp_folders) == 0: hyp_folders.append('No .png files found') else: hyp_folders.append('All') return hyp_folders def ConvertImg(self, folder, DelOld, screenwidth, screenheight): def ResizeImg(img, name, screenwidth, screenheight): POS = .9 #percent of screen ImgW, ImgH = img.size fract = None if ImgW > screenwidth - 100: fract = (ImgW - 100 - 3000 % screenwidth * POS) / ImgW elif ImgH > screenheight - 100: fract = (ImgW - 100 - 3000 % screenheight * POS) / ImgH if fract: w = int(ImgW * fract) h = int(ImgH * fract) reimg = img.resize((w, h), Image.ANTIALIAS) reimg.save(name + '.png', "PNG") print('Resizing...') return reimg return img filelist = glob(folder + '*.jpg') + glob(folder + '*.png') x = 0 for file in filelist: try: print(x, 'of', len(filelist), file) name, sep, tail = file.rpartition('.') print(file) with Image.open(file) as im: im = ResizeImg(im, name, screenwidth, screenheight) im.save(name + '.png', "PNG") x += 1 except OSError as e: print('\n', e, '\n', 'error', file, '\n') if DelOld == 1: print( 'clearing old .jpgs and resizing images too large for your screen...' ) for file in filelist: if '.jpg' in file: remove(file) def GenBGList(self, BGPath='Resources\\Background Gif Original'): bglist = [] Filepath = path.abspath(BGPath) for item in glob(Filepath + '/*.gif', recursive=True): NewPath = item.split('Resources\\Background Gif Original\\')[-1] bglist.append(NewPath) return bglist def formatGifs(self): print('Formatting Gifs...') mywidth, myheight = self.width, self.height Filepath = path.abspath('Resources\\Background Gif Original') self.ExtractFrames(mywidth, myheight, Filepath) self.background_list = self.GenBGList() print('Done.') def ExtractFrames(self, mywidth, myheight, Filepath): for OGGif in glob(Filepath + '\\*.gif', recursive=True): frame = Image.open(OGGif) nframes = 0 namecount = 0 while frame: if 'POV' in path.basename(OGGif): wx = (mywidth - 50) / frame.width hx = (myheight - 50) / frame.height if wx > hx: Tup = (int(frame.width * hx), int(frame.height * hx)) else: Tup = (int(frame.width * wx), int(frame.height * wx)) sizeframe = frame.resize(Tup, Image.ANTIALIAS) else: sizeframe = frame.resize((mywidth, myheight), Image.ANTIALIAS) FileDst = OGGif.replace('Resources\Background Gif Original', 'Resources\Gifs').replace('.gif', '') + '\\' if not path.exists(FileDst): makedirs(FileDst) cnt = str(namecount) if len(str(namecount)) == 1: cnt = '000' + str(namecount) elif len(str(namecount)) == 2: cnt = '00' + str(namecount) elif len(str(namecount)) == 3: cnt = '0' + str(namecount) else: cnt = str(namecount) OutFile = '%s/%s-%s.gif' % (FileDst, path.basename( OGGif).replace('.gif', '').replace('/', ''), cnt) sizeframe.save(OutFile, 'GIF', quality=95) nframes += 1 namecount = round(namecount + 1, 1) try: frame.seek(nframes) except EOFError: break def HandleOSBackground(self, Value): try: if Value == 1: windll.user32.SystemParametersInfoW( 20, 0, path.abspath( "Resources/Desktop Backgrounds/Overlay Background.png" ), 0) elif Value == 'Exit': windll.user32.SystemParametersInfoW( 20, 0, path.abspath( "Resources/Desktop Backgrounds/Background.png"), 0) except Exception as e: print('Desktop Background Setup Failed.') print(e) def DestroyActions(self, Exit=False): if self.Editting or self.OverlayActive or Exit: self.Editting = False self.ActionMenuOpen = False self.WSActive = False self.OverlayActive = False self.BtnHypno.config(text='Start') if self.c_hypno.poll() == False: self.p_hypno.send(True) try: self.ActionMenu.destroy() except AttributeError: pass try: self.WSFrame.destroy() except AttributeError: pass try: self.EditMenu.destroy() except AttributeError: pass def SavePref(self): self.hyp_gfile_var = 0 for item in self.hyp_folders: if item == self.hyp_gfile.get(): break self.hyp_gfile_var += 1 self.background_select_var = 0 for item in self.background_list: if item == self.background_select.get(): break self.background_select_var += 1 PrefDictList = [ 'hyp_delay:' + str(self.hyp_delay.get()), 'hyp_opacity:' + str(self.hyp_opacity.get()), 'hyp_able:' + str(self.hyp_able.get()), 'hyp_pinup:' + str(self.hyp_pinup.get()), 'delold:' + str(self.delold.get()), 'hyp_gfile_var:' + str(self.hyp_gfile_var), 'actionmenu:' + str(self.UseActionMenu.get()), 'background_select_var:' + str(self.background_select_var), 's_rulename:' + str(self.s_rulename.get()), 'UseHSBackground:' + str(self.UseHSBackground.get()) ] Filepath = path.abspath('Resources\\Preferences.txt') with open(Filepath, 'w') as f: for line in PrefDictList: f.write(line + '\n') def Shutdown(self): try: self.SavePref() if self.Old_UseHSBackground == 1 or self.UseHSBackground.get( ) == 1: self.HandleOSBackground('Exit') self.DestroyActions(True) self.quit() except Exception as e: print(e)
def ui(self): root = Tk() # 窗口的标题 root.title('PopulationGenerator') # 创建大小和位置 width = root.winfo_screenwidth() height = root.winfo_screenheight() root_height = 400 root_wight = 1000 x_width = (width - root_wight) / 2 x_height = (height - root_height) / 2 root.geometry('%dx%d+%d+%d' % (root_wight, root_height, x_width, x_height)) self.host = StringVar() self.port = StringVar() tab_main = Notebook(root) tab_main.place(relx=0.02, rely=0.02, relwidth=0.887, relheight=0.876) tab1 = Frame(tab_main) tab1.place(x=0, y=30) tab_main.add(tab1, text='wiki') # 将第一页插入分页栏中 frameTop = Frame(tab1, pady=10) frameTop.pack() frameCenter = Frame(tab1, pady=10) frameCenter.pack() frameBottom = Frame(tab1, pady=10) frameBottom.pack() # 选择年份的 yearLabel = Label(frameTop, text='year:', font=12, pady=3, padx=5) yearLabel.grid(row=0, column=0) self.yearBox = Combobox(frameTop) self.yearBox['values'] = self.years self.yearBox.bind('<<ComboboxSelected>>', self.getState) self.yearBox.grid(row=0, column=1) # 选择州 stateLabel = Label(frameTop, text='state:', font=12, pady=3, padx=5) stateLabel.grid(row=0, column=2) self.stateBox = Combobox(frameTop) self.stateBox.grid(row=0, column=3) hostLabel = Label(frameTop, text='host:', font=12, pady=3, padx=5) hostLabel.grid(row=1, column=0) self.hostText = Entry(frameTop, textvariable=self.host) self.hostText.grid(row=1, column=1) portLabel = Label(frameTop, text='port:', font=12, pady=3, padx=5) portLabel.grid(row=1, column=2) self.portText = Entry(frameTop, textvariable=self.port) self.portText.grid(row=1, column=3) # 请求按钮 button = Button(frameBottom, text='generate', padx=30, pady=10, command=self.get_result) button.pack() # 显示数据结果 # self.text = Text(frameBottom, height=4) self.resultData = StringVar() self.text = Label(frameBottom, textvariable=self.resultData, height=4, bg='green', fg='white', width=50, font=15) self.text.pack() tab2 = Frame(tab_main) tab2.place(x=100, y=30) tab_main.add(tab2, text='life_server') frameTop2 = Frame(tab2, pady=10) frameTop2.pack() typeLabel = Label(frameTop2, text='type:', font=12, pady=3, padx=5) typeLabel.grid(row=0, column=0) self.typeValue = StringVar() typeEntry = Entry(frameTop2, textvariable=self.typeValue) typeEntry.grid(row=0, column=1) categoryLabel = Label(frameTop2, text='category:', font=12, pady=3, padx=5) categoryLabel.grid(row=1, column=0) self.categoryValue = StringVar() categoryEntry = Entry(frameTop2, textvariable=self.categoryValue) categoryEntry.grid(row=1, column=1) number_to_generateLabel = Label(frameTop2, text='number_to_generate:', font=12, pady=3, padx=5) number_to_generateLabel.grid(row=2, column=0) self.number_to_generateValue = StringVar() number_to_generateEntry = Entry( frameTop2, textvariable=self.number_to_generateValue) number_to_generateEntry.grid(row=2, column=1) frameBottom2 = Frame(tab2, pady=10) frameBottom2.pack() # 发送按钮 button2 = Button(frameBottom2, text='send', padx=30, pady=10, command=self.sendToLifeServer) button2.pack() self.tableData = Treeview(tab2) self.tableData['columns'] = [str(i + 1) for i in range(20)] for item in self.tableData['columns']: self.tableData.column(item, width=40) self.tableData.heading(item, text=item) self.tableData.pack() scrollbar = Scrollbar(tab2, orient='horizontal', command=self.tableData.xview) scrollbar.pack() self.tableData.configure(yscrollcommand=scrollbar.set) root.mainloop()
def __init__(self, root): self.root = root self.root.title("Login System") self.root.geometry("500x300") self.root.iconbitmap("logo590.ico") self.root.resizable(0, 0) sid = StringVar() email = StringVar() password = StringVar() def on_enter1(e): but_Login['background'] = "black" but_Login['foreground'] = "cyan" def on_leave1(e): but_Login['background'] = "SystemButtonFace" but_Login['foreground'] = "SystemButtonText" def on_enter2(e): but_clear['background'] = "black" but_clear['foreground'] = "cyan" def on_leave2(e): but_clear['background'] = "SystemButtonFace" but_clear['foreground'] = "SystemButtonText" def on_enter3(e): but_view['background'] = "black" but_view['foreground'] = "cyan" def on_leave3(e): but_view['background'] = "SystemButtonFace" but_view['foreground'] = "SystemButtonText" def on_enter4(e): but_delete['background'] = "black" but_delete['foreground'] = "cyan" def on_leave4(e): but_delete['background'] = "SystemButtonFace" but_delete['foreground'] = "SystemButtonText" def on_enter5(e): but_clear_tree['background'] = "black" but_clear_tree['foreground'] = "cyan" def on_leave5(e): but_clear_tree['background'] = "SystemButtonFace" but_clear_tree['foreground'] = "SystemButtonText" def clear(): sid.set("") email.set("") password.set("") def add_logins(): if len(email.get()) != 0: if len(password.get()) != 0: add_login(email.get(), password.get()) clear() else: tkinter.messagebox.showerror("Eroor", "Please Enter Password") else: tkinter.messagebox.showerror("Error", "Please Enter Email") def view_logins(): login_trees.delete(*login_trees.get_children()) for row in view_login(): login_trees.insert('', END, values=row) def clear_tree(): login_trees.delete(*login_trees.get_children()) def delete_logins(): if (len(sid.get()) != 0): delete_login(sid.get()) view_logins() clear() else: tkinter.messagebox.showerror( "Error", "Please Enter number to delete contact") #===================frame====================# mainframe = Frame(self.root, width=500, height=300, relief="ridge", bd=3) mainframe.place(x=0, y=0) #============================================# #notebook tabControl = Notebook(mainframe, width=491, height=270) login_frame = Frame(tabControl, background="grey57") view_login_frame = Frame(tabControl, background="grey87") tabControl.add(login_frame, text='Login') tabControl.add(view_login_frame, text='View Delete Login') tabControl.place(x=0, y=0) #============================================# def game(event): crow = login_trees.focus() contents = login_trees.item(crow) row = contents['values'] sid.set(row[0]) email.set(row[1]) password.set(row[2]) scol = Scrollbar(view_login_frame, orient="vertical") scol.place(relx=1, rely=0, relheight=1, anchor='ne') login_trees = ttk.Treeview(view_login_frame, columns=("ID", "Email", "Password"), height=10, yscrollcommand=scol.set) login_trees.heading("ID", text="ID") login_trees.heading("Email", text="Email") login_trees.heading("Password", text="Password") login_trees['show'] = "headings" login_trees.column("ID", width=50, minwidth=10) login_trees.column("Email", width=225, minwidth=40) login_trees.column("Password", width=196, minwidth=40) login_trees.place(x=0, y=0) login_trees.bind('<ButtonRelease-1>', game) but_view = Button(view_login_frame, text="View", font=('times new roman', 13), width=14, cursor="hand2", command=view_logins) but_view.place(x=10, y=233) but_view.bind("<Enter>", on_enter3) but_view.bind("<Leave>", on_leave3) but_delete = Button(view_login_frame, text="Delete", font=('times new roman', 13), width=14, cursor="hand2", command=delete_logins) but_delete.place(x=167, y=233) but_delete.bind("<Enter>", on_enter4) but_delete.bind("<Leave>", on_leave4) but_clear_tree = Button(view_login_frame, text="Clear", font=('times new roman', 13), width=14, cursor="hand2", command=clear_tree) but_clear_tree.place(x=327, y=233) but_clear_tree.bind("<Enter>", on_enter5) but_clear_tree.bind("<Leave>", on_leave5) #==============================================# ent_id = Entry(login_frame, width=3, font=('times new roman', 15), relief="ridge", bd=3, textvariable=sid) ent_id.place(x=5, y=5) lab_email = Label(login_frame, text="Email", font=('times new roman', 15), bg="grey57", fg="white") lab_email.place(x=200, y=20) ent_email = Entry(login_frame, width=40, font=('times new roman', 15), relief="ridge", bd=3, textvariable=email) ent_email.place(x=40, y=60) lab_password = Label(login_frame, text="Password", font=('times new roman', 15), bg="grey57", fg="white") lab_password.place(x=180, y=100) ent_password = Entry(login_frame, width=40, font=('times new roman', 15), show="*", relief="ridge", bd=3, textvariable=password) ent_password.place(x=40, y=140) but_Login = Button(login_frame, text="Login", font=('times new roman', 16), width=15, cursor="hand2", command=add_logins) but_Login.place(x=40, y=200) but_Login.bind("<Enter>", on_enter1) but_Login.bind("<Leave>", on_leave1) but_clear = Button(login_frame, text="Clear", font=('times new roman', 16), width=15, cursor="hand2", command=clear) but_clear.place(x=255, y=200) but_clear.bind("<Enter>", on_enter2) but_clear.bind("<Leave>", on_leave2)
class App(tk.Tk): window = None def get_title(self, info): return "Музыка {} {} (id{})".format(info["first_name"], info["last_name"], info["id"]) def __init__(self, audio_obj, vk_audio, info): #initialize self if (App.window is not None): return super().__init__() self.vk_audio = vk_audio self.geometry('733x450') self.columnconfigure(0, weight=1) self.count, self.SortDir, self.player_window = False, True, None #initialize notebook self.tabs = Notebook(self) self.tabs.place(x=0, y=0, relwidth=1, relheight=1) self.tabs.bind('<<NotebookTabChanged>>', self.tab_changed) self.list = [] self.add_tab(audio_obj, info) App.window = self def add_tab(self, audio: vk_audio.Audio, info): if (audio in self.list): self.tabs.select(self.list.index(audio)) return title = self.get_title(info) f = tk.Frame(self.tabs) tk.Button(f, text="Закрыть", command=self.on_close_tab_clicked).pack() #add_albums_frame if (audio.Playlists): AlbumsFrame(f, audio.Playlists, self.add_tab_playlist, self.author_clicked).pack(side=tk.TOP, fill=tk.BOTH, expand=False) #add_audios_frame AudiosFrame(f, audio.Audios, True).pack(fill=tk.BOTH, expand=True, side=tk.BOTTOM) self.tabs.add(f, text=title) self.list.append(audio) self.focus_force() self.tabs.select(len(self.list) - 1) return self def on_close_tab_clicked(self): t = self.tabs.select() index = self.tabs.tabs().index(t) self.list.pop(index) if (not self.list): self.destroy() self.tabs.forget(t) def tab_changed(self, event): tab = self.tabs.tab( event.widget.index("current" ) if not isinstance(event, int) else event) self.title(tab['text']) def add_tab_playlist(self, playlist: vk_audio.Playlist): if (playlist in self.list): self.tabs.select(self.list.index(playlist)) return self.list.append(playlist) title = "Плейлист {} (id{})".format(playlist.title, playlist.owner_id) f = tk.Frame(self.tabs) tk.Button(f, text="Закрыть", command=self.on_close_tab_clicked).pack() #region add playlist info tk.Label(f, text=playlist.title, font=('times', 16)).pack() author = tk.Label(f, text=",".join(i['name'] for i in playlist.author_info), font=AlbumsFrame.DEFAULT_FONT, fg=AlbumsFrame.DEF_FG, cursor="hand2") author.pack() author.bind("<Button-1>", lambda _: self.author_clicked(playlist)) author.bind( "<Enter>", lambda _: author.config(font=AlbumsFrame.HOVER_FONT, fg=AlbumsFrame.HOVER_FG)) author.bind( "<Leave>", lambda _: author.config(font=AlbumsFrame.DEFAULT_FONT, fg=AlbumsFrame.DEF_FG)) img = tk.Canvas(f, width=160, height=160) img.pack(pady=5) AlbumsFrame.set_image_from_album(None, img, playlist) #endregion AudiosFrame(f, playlist.Audios, True).pack(fill=tk.BOTH, expand=True, side=tk.BOTTOM) self.tabs.add(f, text=title) self.focus_force() self.tabs.select(len(self.list) - 1) def author_clicked(self, playlist): if (playlist.author_hrefs): for i, item in enumerate(self.list): if (isinstance(item, vk_audio.Audio) and item.owner_id == playlist.owner_id): self.tabs.select(i) break else: artist_music = playlist.artist_music(0) self.add_tab( artist_music, { "first_name": artist_music.nick, "last_name": "", "id": artist_music.owner_id }) elif (playlist.owner_id > 0): for i, item in enumerate(self.list): if (isinstance(item, vk_audio.Audio) and item.owner_id == playlist.owner_id): self.tabs.select(i) break else: self.add_tab(self.vk_audio.load(playlist.owner_id)) else: messagebox.showerror("Ошибка", "Пока брать музыку у артиста(") def destroy(self): if (App.window is self): App.window = None return super().destroy() @staticmethod def get(item=None, owner_id=None, vk_audio=None, info=None): if (item is None and vk_audio is not None): item = vk_audio.load(owner_id=owner_id) return App( audio_obj=item, info=info, vk_audio=vk_audio) if App.window is None else App.window.add_tab( item, info)
class AppLauncher: def __init__(self): self.__root = Tk() self.__notebook = Notebook() if user32: self.__notebook.bind("<Map>", self._maximizeUnderWindows) @property def root(self): return self.__root def run(self, entry, baseTabLoader = BaseTabLoader()): self.__configurationFiles = self._createConfigurationInstances() self._loadConfigurationFiles() self._upgradeConfigurationFiles() Config["version"] = __version__ self._createStyles() self._createLayouts() self._configureRoot() CommonUIComponents.init(**self._getCommonUIComponentsInitParams()) SmartWidget.setFont() sys.path.append(path.dirname(path.dirname(path.abspath(entry)))) baseTabLoader.load(self.__notebook, Config.INSTANCE.json, Storage.INSTANCE.json) self.__notebook.place(relwidth = 1, relheight = 1) Global.appLauncher = self self.__root.mainloop() def _configureRoot(self): self.__root.geometry(f"{self.__root.winfo_screenwidth()}x{self.__root.winfo_screenheight()}") # # There's a bug under Linux: if height == False, window contents # aren't centered vertically. Moreover, the app must be maximized # under Windows, otherwise vertical scrollbars don't scroll content # to the end. # self.__root.resizable(False, True) self.__root.title(Config["title"]) self.__root.protocol("WM_DELETE_WINDOW", self._onDeleteWindow) def _createConfigurationInstances(self): _ = self return {"config": Config(), "storage": Storage()} def _createStyles(self): font = Config["widgetFont"] self.__root.style = Style() self.__root.style.configure(".", font = font) self.__root.style.configure("TButton", padding = [12, 7]) self.__root.style.configure("TNotebook.Tab", padding = [13, 7]) self.__root.style.configure("Horizontal.TScale", sliderthickness = 25) self.__root.style.configure("Horizontal.TScrollbar", arrowsize = 25) self.__root.style.configure("Vertical.TScrollbar", arrowsize = 25) self.__root.style.configure("TSpinbox", arrowsize = 30) self.__root.option_add('*TCombobox*Listbox.font', font) colors = { "Cyan": "cyan", "LGreen": "lightgreen", "Pink": "pink", "Yellow": "yellow" } styles = { "": "Frame", "Labeled": "Labelframe" } for style in styles.items(): for color in colors.items(): self.__root.style.configure(f"{color[0]}.T{style[0]}Container.TBaseContainer.T{style[1]}", background = color[1]) def _createLayouts(self): name = "Scrollbar" for orient in ("Horizontal", "Vertical"): self.__root.style.layout(f"{orient}.T{name}.T{name}", self.__root.style.layout(f"{orient}.T{name}")) def _getCommonUIComponentsInitParams(self): _ = self return dict() def _loadConfigurationFiles(self): for configurationFile in self.__configurationFiles.values(): configurationFile.load() def _maximizeUnderWindows(self, _): _ = self user32.ShowWindow(user32.GetForegroundWindow(), 3) def _onDeleteWindow(self): for name in self.__notebook.tabs(): self.__notebook.nametowidget(name).onDeleteWindow() for configurationFile in self.__configurationFiles.values(): configurationFile.dump() self.__root.destroy() def _upgradeConfigurationFiles(self): for configurationFile in self.__configurationFiles.values(): configurationFile.upgrade(Config.INSTANCE.json.get("version", "1.6.7"))
def __init__(self, root): self.root = root self.root.title("Songs Download") self.root.geometry("700x605") self.root.resizable(0, 0) self.root.iconbitmap("music.ico") website_url = StringVar() website = StringVar() song_name = StringVar() song_url = StringVar() #=======================hower============================================# #button hower in about tab def on_enter1(e): but_user_manual['background'] = "black" but_user_manual['foreground'] = "cyan" def on_leave1(e): but_user_manual['background'] = "SystemButtonFace" but_user_manual['foreground'] = "SystemButtonText" def on_enter2(e): but_websites['background'] = "black" but_websites['foreground'] = "cyan" def on_leave2(e): but_websites['background'] = "SystemButtonFace" but_websites['foreground'] = "SystemButtonText" def on_enter3(e): but_Source['background'] = "black" but_Source['foreground'] = "cyan" def on_leave3(e): but_Source['background'] = "SystemButtonFace" but_Source['foreground'] = "SystemButtonText" #======================================================================== #hover button in download songs tab def on_enter4(e): but_download_songs['background'] = "black" but_download_songs['foreground'] = "cyan" def on_leave4(e): but_download_songs['background'] = "SystemButtonFace" but_download_songs['foreground'] = "SystemButtonText" def on_enter5(e): but_clear['background'] = "black" but_clear['foreground'] = "cyan" def on_leave5(e): but_clear['background'] = "SystemButtonFace" but_clear['foreground'] = "SystemButtonText" #============================================================== def on_enter6(e): but_scrape_songs['background'] = "black" but_scrape_songs['foreground'] = "cyan" def on_leave6(e): but_scrape_songs['background'] = "SystemButtonFace" but_scrape_songs['foreground'] = "SystemButtonText" def on_enter7(e): but_clear_list['background'] = "black" but_clear_list['foreground'] = "cyan" def on_leave7(e): but_clear_list['background'] = "SystemButtonFace" but_clear_list['foreground'] = "SystemButtonText" #========================================button function========================== def clear_list(): try: website_url.set("") website.set("select websites") os.remove("C:\\TEMP\\songs.txt") texttopaste.delete(1.0, "end") except: tkinter.messagebox.showerror("error", "filenotfound") def clear(): song_name.set("") song_url.set("") def scrape(): try: if website.get == "select websites" and website_url.get == "": tkinter.messagebox.showerror("Error", "No website is selected") else: with open("C:\\TEMP\\songs.txt", "w") as f: time.sleep(0.3) if website.get() == "talk2trend-bollywood": website_url.set( "https://www.talk2trend.com/bollywood-songs-mp3-download.html" ) response = requests.get(website_url.get()) Soup = BeautifulSoup(response.text, "html.parser") gather = Soup.findAll("td") for childrens in gather: child = childrens.findChildren("a", recursive=True) for childs in child: f.write("\n") f.write(childs.get("href")) f.write("\n") if website.get() == "talk2trend-english": website_url.set( "https://www.talk2trend.com/english-songs-mp3-download.html" ) response = requests.get(website_url.get()) Soup = BeautifulSoup(response.text, "html.parser") gather = Soup.findAll("td") for childrens in gather: child = childrens.findChildren("a", recursive=True) for childs in child: f.write("\n") f.write(childs.get("href")) f.write("\n") ## gather=Soup.findAll("td") ## for childrens in gather: ## child=childrens.findChildren("a",recursive=True) ## for childs in child: ## print(childs.get("href")) if website.get() == "filmisongs-english": website_url.set( "https://filmisongs.com/english-mp3-songs-download/page/1/" ) response = requests.get(website_url.get()) Soup = BeautifulSoup(response.text, "html.parser") gather = Soup.findAll("h2", class_="post-title") for childrens in gather: child = childrens.findChildren("a", recursive=True) for childs in child: f.write("\n") f.write(childs.get("href")) f.write("\n") if website.get() == "filmisongs-cdn": response = requests.get(website_url.get()) Soup = BeautifulSoup(response.text, "html.parser") gather = Soup.findAll("a", class_="button") for name in gather: f.write("\n") f.write(name.get("href")) if website.get() == "filmisongs": response = requests.get(website_url.get()) Soup = BeautifulSoup(response.text, "html.parser") gather = Soup.findAll("h2", class_="post-title") for childrens in gather: child = childrens.findChildren("a", recursive=True) for childs in child: f.write("\n") f.write(childs.get("href")) f.write("\n") #filmisongs-bollywood #https://filmisongs.com/bollywood-movies-mp3-songs-download/page/1/ if website.get() == "filmisongs-bollywood": website_url.set( "https://filmisongs.com/bollywood-movies-mp3-songs-download/page/1/" ) response = requests.get(website_url.get()) Soup = BeautifulSoup(response.text, "html.parser") gather = Soup.findAll("h2", class_="post-title") for childrens in gather: child = childrens.findChildren("a", recursive=True) for childs in child: f.write("\n") f.write(childs.get("href")) f.write("\n") if website.get() == "songsmp3": #website_url.set("https://www.songsmp3.biz/singers/yo-yo-honey-singh/page-1.html") response = requests.get(website_url.get()) Soup = BeautifulSoup(response.text, "html.parser") gather = Soup.findAll("a", class_="dowbut") names = set(gather) for name in names: f.write("\n") f.write("https://www.songsmp3.biz{}".format( name.get("href"))) f.write("\n") if website.get() == "songsmp3-yoyohoneysingh": website_url.set( "https://www.songsmp3.biz/singers/yo-yo-honey-singh/page-2.html" ) response = requests.get(website_url.get()) Soup = BeautifulSoup(response.text, "html.parser") gather = Soup.findAll("a", class_="dowbut") names = set(gather) for name in names: f.write("\n") f.write("https://www.songsmp3.biz{}".format( name.get("href"))) f.write("\n") if website.get() == "songsmp3-download": #website_url.set("https://www.songsmp3.biz/singers/yo-yo-honey-singh/page-1.html") response = requests.get(website_url.get()) Soup = BeautifulSoup(response.text, "html.parser") gather = Soup.findAll("a", class_="dowbutzip") names = set(gather) for name in names: f.write("\n") f.write(name.get("href")) f.write("\n") #https://www.songsmp3.biz/category/top?type=today with open("C:\\TEMP\\songs.txt", "r") as f: texttopaste.insert("end", f.read()) except: tkinter.messagebox.showerror( "Error", "no website selected or network error") def download(): try: prg.start(10) if song_name.get() == "" and song_url.get() == "": tkinter.messagebox.showerror( "Error", "please enter song name and url") elif song_name.get() == "": tkinter.messagebox.showerror("Error", "please enter song name") else: url = song_url.get() r = requests.get(url) self.root.update() with open( 'C:/Users/SHREYAS/Desktop/shreyas python/Songsdownload/{}.mp3' .format(song_name.get()), 'wb') as f: f.write(r.content) prg.stop() except: pass def starts(): t2 = threading.Thread(target=download) t2.start() def websites(): root1 = Toplevel(self.root) root1.title("Websites") root1.geometry("400x400") root1.resizable(0, 0) frame_web = Frame(root1, width=400, height=400, relief="ridge", bd=4) frame_web.place(x=0, y=0) mess_1 = Label( frame_web, text="step 1:talk2trend/bollywood and talk2trend/english", anchor="w", font=('times new roman', 11, 'bold')) mess_1.place(x=10, y=25) mess_2 = Label( frame_web, text="step 2: Click the scrape button to scrape the website", anchor="w", font=('times new roman', 11, 'bold')) mess_2.place(x=10, y=45) root1.mainloop() def usermanual(): root2 = Toplevel(self.root) root2.title("User Manual") root2.geometry("400x400") root2.resizable(0, 0) frame_um = Frame(root2, width=400, height=400, relief="ridge", bd=4) frame_um.place(x=0, y=0) lab_heading = Label(frame_um, text="User Manual", font=('times new roman', 13, 'bold')) lab_heading.place(x=130, y=0) mess_1 = Label( frame_um, text="step 1: Choose a website from the given combination box", anchor="w", font=('times new roman', 11, 'bold')) mess_1.place(x=10, y=25) mess_2 = Label( frame_um, text="step 2: Click the scrape button to scrape the website", anchor="w", font=('times new roman', 11, 'bold')) mess_2.place(x=10, y=45) mess_3 = Label(frame_um, text="step 3: Select the url of the given song", anchor="w", font=('times new roman', 11, 'bold')) mess_3.place(x=10, y=65) mess_4 = Label(frame_um, text="step 4: Go to download songs tab ", anchor="w", font=('times new roman', 11, 'bold')) mess_4.place(x=10, y=85) mess_5 = Label(frame_um, text="step 5: Place the song url in box ", anchor="w", font=('times new roman', 11, 'bold')) mess_5.place(x=10, y=105) mess_6 = Label( frame_um, text="step 6: Give the name to save the song name ", anchor="w", font=('times new roman', 11, 'bold')) mess_6.place(x=10, y=125) mess_7 = Label(frame_um, text="step 7: Click on download button ", anchor="w", font=('times new roman', 11, 'bold')) mess_7.place(x=10, y=145) mess_8 = Label(frame_um, text="step 8: Wait till the songs download ", anchor="w", font=('times new roman', 11, 'bold')) mess_8.place(x=10, y=165) mess_9 = Label( frame_um, text="step 9: Songs will be store automatically in folder ", anchor="w", font=('times new roman', 11, 'bold')) mess_9.place(x=10, y=185) mess_10 = Label(frame_um, text="step 10:Play the song and enjoy ", anchor="w", font=('times new roman', 11, 'bold')) mess_10.place(x=10, y=205) root2.mainloop() def Sourcecode(): root3 = Toplevel(self.root) root3.title("Source Code") root3.geometry("400x400") root3.resizable(0, 0) frame_sc = Frame(root3, width=400, height=400, relief="ridge", bd=4) frame_sc.place(x=0, y=0) root3.mainloop() #=============================Frames================================# mainframe = Frame(self.root, width=700, height=605, bg="grey77", bd=3, relief="ridge") mainframe.place(x=0, y=0) firstframe = Frame(mainframe, width=695, height=250, bg="grey66", bd=4, relief="ridge") firstframe.place(x=0, y=0) secondframe = Frame(mainframe, width=695, height=320, bg="grey66", bd=4, relief="ridge") secondframe.place(x=0, y=250) thirdframe = Frame(mainframe, width=695, height=30, bg="white", bd=4, relief="ridge") thirdframe.place(x=0, y=570) #===========================first frame / notebook===========================================# tabControl = Notebook(firstframe, width=683, height=214) scrape_songs = Frame(tabControl, background="grey57") download_songs = Frame(tabControl, background="grey87") about = Frame(tabControl, background="grey77") tabControl.add(scrape_songs, text='Scrape songs') tabControl.add(download_songs, text='Download songs') tabControl.add(about, text='About') tabControl.place(x=0, y=0) #====================================firstframe/nootbook/about================================================# messages1 = Message( about, text= "This project is all about fun and learning this project will help you to find out how you can scrape songs in different all this project goes to the author of this project \ shreyas mohite", font='Arial 12', anchor=W) messages1.place(x=4, y=4) messages2 = Message( about, text= "This project required internet connections so please make sure that you are connected to network all the activities in this project is online ,else this will display error message \ ", font='Arial 12', anchor=W) messages2.place(x=229, y=4) messages3 = Message( about, text= "The Source code of this project is available on github you can use it as per your requirement this will help you out.The given buttons will show you how to use this software \ ", font='Arial 12', anchor=W) messages3.place(x=454, y=4) #==================button on About nootbook=============================================# but_user_manual = Button(about, text="User Manual", font=('times new roman', 12, "bold"), width=15, cursor="hand2", command=usermanual) but_user_manual.place(x=35, y=170) but_user_manual.bind("<Enter>", on_enter1) but_user_manual.bind("<Leave>", on_leave1) but_websites = Button(about, text="Websites", font=('times new roman', 12, "bold"), width=15, cursor="hand2", command=websites) but_websites.place(x=260, y=170) but_websites.bind("<Enter>", on_enter2) but_websites.bind("<Leave>", on_leave2) but_Source = Button(about, text="Source code", font=('times new roman', 12, "bold"), width=15, cursor="hand2", command=Sourcecode) but_Source.place(x=490, y=170) but_Source.bind("<Enter>", on_enter3) but_Source.bind("<Leave>", on_leave3) #=============================Download songs tab=============================================================# lab_url = Label(download_songs, text="Enter Song Url", font=('times new roman', 12, 'bold'), background="grey87") lab_url.place(x=40, y=30) Ent_songs_url = Entry(download_songs, textvariable=song_url, width=50, font=('times new roman', 12, 'bold'), bd=4, relief='ridge') Ent_songs_url.place(x=230, y=30) lab_save_as_name = Label(download_songs, text="Song Saves as Name", font=('times new roman', 12, 'bold'), background="grey87") lab_save_as_name.place(x=40, y=110) Ent_save_as_name = Entry(download_songs, textvariable=song_name, width=20, font=('times new roman', 12, 'bold'), bd=4, relief='ridge') Ent_save_as_name.place(x=230, y=105) but_download_songs = Button(download_songs, text="Download", font=('times new roman', 12, "bold"), width=15, cursor="hand2", command=starts) but_download_songs.place(x=260, y=170) but_download_songs.bind("<Enter>", on_enter4) but_download_songs.bind("<Leave>", on_leave4) but_clear = Button(download_songs, text="Clear", font=('times new roman', 12, "bold"), width=15, cursor="hand2", command=clear) but_clear.place(x=490, y=170) but_clear.bind("<Enter>", on_enter5) but_clear.bind("<Leave>", on_leave5) #==========================================Scrape songs tab=========================================================================# lab_web = Label(scrape_songs, text="Select Websites ", font=('times new roman', 12, 'bold'), background="grey57", fg="white") lab_web.place(x=20, y=10) list_websites = [ "filmisongs", "filmisongs-cdn", "talk2trend-bollywood", "talk2trend-english", "filmisongs-bollywood", "filmisongs-english", "songsmp3", "songsmp3-yoyohoneysingh", "songsmp3-download" ] list_websites_combo = Combobox(scrape_songs, values=list_websites, font=('arial', 10), width=19, state="readonly", textvariable=website) list_websites_combo.set("select websites") list_websites_combo.place(x=180, y=10) lab_website_url = Label(scrape_songs, text="Website Url", font=('times new roman', 12, 'bold'), background="grey57", fg="white") lab_website_url.place(x=300, y=60) Ent_website_url = Entry(scrape_songs, width=75, font=('times new roman', 12, 'bold'), textvariable=website_url, bd=4, relief='ridge') Ent_website_url.place(x=35, y=100) but_scrape_songs = Button(scrape_songs, text="Scrape Songs", font=('times new roman', 12, "bold"), width=15, cursor="hand2", command=scrape) but_scrape_songs.place(x=260, y=170) but_scrape_songs.bind("<Enter>", on_enter6) but_scrape_songs.bind("<Leave>", on_leave6) but_clear_list = Button(scrape_songs, text="Clear List", font=('times new roman', 12, "bold"), width=15, cursor="hand2", command=clear_list) but_clear_list.place(x=490, y=170) but_clear_list.bind("<Enter>", on_enter7) but_clear_list.bind("<Leave>", on_leave7) #==========================bottomframe=============================================# scol1 = Scrollbar(secondframe, orient="vertical") scol1.place(relx=1, rely=0, relheight=1, anchor='ne') texttopaste = Text(secondframe, height=16, width=83, font=('times new roman', 12, 'bold'), yscrollcommand=scol1.set, relief="sunken", bd=3) texttopaste.place(x=0, y=0) scol1.config(command=texttopaste.yview) #=========================================================================#\ prg = Progressbar(thirdframe, length=688, orient=HORIZONTAL, mode='indeterminate') prg.place(x=0, y=0)
def main(): global c1, nb2_tab1, nb2_tab2, filename, var1, var2, progress1, labelprogress, panel2 master.geometry("1480x900") master.title("ImageToGCodeGenerator") b1 = Button(master, text="Open File", command=callback_advanced, bg='lightgrey', fg='black') b1.place(x=10, y=10) nb = Notebook(master, width=1450, height=300) nb.place(x=10, y=50) tab1 = Frame(nb) tab2 = Frame(nb) tab3 = Frame(nb) tab4 = Frame(nb) tab5 = Frame(nb) nb.add(tab1, text=" Image Geometry ") nb.add(tab2, text=" Image Enhance ") nb.add(tab3, text=" Image Filter ") nb.add(tab4, text=" Image Binary ") nb.add(tab5, text=" GCODE Settings ") nb2 = Notebook(master, width=550, height=550) nb2.place(x=910, y=420) nb2_tab1 = Frame(nb2) nb2_tab2 = Frame(nb2) nb2.add(nb2_tab1, text=" Modified") nb2.add(nb2_tab2, text=" GCODE Visualization") panel2 = Label(nb2_tab1) panel2.place(x=0, y=0) c1 = Canvas(nb2_tab2, width=500, height=500, bg='lightgreen') c1.place(x=0, y=0) #FILTERS chk1 = Checkbutton(tab3, text="EdgeDetect", variable=var1, command=update_image_advanced) chk1.place(x=20, y=20) chk4 = Checkbutton(tab3, text="Blur", variable=var_blur, command=update_image_advanced) chk4.place(x=20, y=60) chk5 = Checkbutton(tab3, text="Contour", variable=var_contour, command=update_image_advanced) chk5.place(x=20, y=100) chk6 = Checkbutton(tab3, text="Smooth", variable=var_smooth, command=update_image_advanced) chk6.place(x=20, y=140) chk6 = Checkbutton(tab3, text="Sharpen", variable=var_sharpen, command=update_image_advanced) chk6.place(x=20, y=180) chk6 = Checkbutton(tab3, text="Gauss Blur", variable=var_gauss_blur, command=update_image_advanced) chk6.place(x=20, y=220) entryGauseBlur = Entry(tab3, textvariable=gausradius, width=10) entryGauseBlur.place(x=150, y=220) entryGauseBlur.insert(0, '2') #BINARY OPTIONS # scale1 = Scale(master,from_=0,to=255,orien=HORIZONTAL,command=scale_update,length=250) scale1 = Scale(tab4, from_=0, to=255, orien=HORIZONTAL, length=250, variable=scale1_var) scale1.bind("<ButtonRelease-1>", scale_update_advanced) scale1.place(x=20, y=70) label_high_th = Label(tab4, text="Upper Black Threshold") label_high_th.place(x=280, y=90) scale2 = Scale(tab4, from_=0, to=255, orien=HORIZONTAL, length=250, variable=scale2_var) scale2.place(x=20, y=110) scale2.bind("<ButtonRelease-1>", scale_update2_advanced) label_low_th = Label(tab4, text="Lower Black Threshold") label_low_th.place(x=280, y=130) chk3 = Checkbutton(tab4, text="Binarise", variable=binarize, command=update_image_advanced) chk3.place(x=20, y=25) chk2 = Checkbutton(tab4, text="Invert", variable=var2, command=update_image_advanced) chk2.place(x=20, y=50) #ENHANCE scale3 = Scale(tab2, from_=0, to=100, orien=HORIZONTAL, length=250, variable=scale3_var) scale3.set(value=10) scale3.place(x=40, y=20) scale3.bind("<ButtonRelease-1>", scale_update3_advanced) label_contrast = Label(tab2, text="Contrast") label_contrast.place(x=300, y=40) scale4 = Scale(tab2, resolution=0.01, from_=0, to=1, orien=HORIZONTAL, length=250, variable=scale4_var) scale4.set(value=1) scale4.place(x=40, y=60) scale4.bind("<ButtonRelease-1>", process_data_advanced) label_brightness = Label(tab2, text="Brightness") label_brightness.place(x=300, y=80) scale5 = Scale(tab2, resolution=0.01, from_=0, to=2, orien=HORIZONTAL, length=250, variable=scale5_var) scale5.set(value=1) scale5.place(x=40, y=100) scale5.bind("<ButtonRelease-1>", process_data_advanced) label_colour = Label(tab2, text="Colour") label_colour.place(x=300, y=120) #GEOMETRY chk7 = Checkbutton(tab1, text="Flip Vertical", variable=var_flipv, command=update_image_advanced) chk7.place(x=240, y=90) chk8 = Checkbutton(tab1, text="Flip Horizontal", variable=var_fliph, command=update_image_advanced) chk8.place(x=360, y=90) chk10 = Checkbutton(tab1, text="Rotate", variable=var_rotate, command=update_image_advanced) chk10.place(x=240, y=150) rotate_entry = Entry(tab1, width=4, textvariable=rotate_angle) rotate_entry.insert(0, '0') rotate_entry.place(x=340, y=150) #GCODE progress1 = Progressbar(tab5, length=250, mode='determinate') progress1.place(x=1000, y=140) progress1['value'] = 0 b3 = Button(tab5, text="Generate Gcode", command=generate_gcode) b3.place(x=1280, y=130) labelprogress = Label(tab5, text="Current Task: Idle") labelprogress.place(x=1000, y=115) tBox1 = Entry(tab5, text="Scale", textvariable=x_res, width=5) tBox1.insert(0, '400') tBox1.place(x=20, y=20) tbox1_label = Label(tab5, text="Scale: 1 = original size(500mm x 500mm)") tbox1_label.place(x=70, y=20) #tBox2 = Entry(tab5, text="Yres", textvariable=y_res, width=5) #tBox2.insert(0, '300') #tBox2.place(x=20, y=50) #tbox2_label = Label(tab5, text="Required height of gcode(mm)") #tbox2_label.place(x=70, y=50) tBox3 = Entry(tab5, textvariable=spacing, width=5) tBox3.insert(0, '2') tBox3.place(x=20, y=80) tbox3_label = Label(tab5, text="Join points seperated by(mm)") tbox3_label.place(x=70, y=80) tBox3 = Entry(tab5, textvariable=remove_short, width=5) tBox3.insert(0, '2') tBox3.place(x=20, y=110) tbox3_label = Label(tab5, text="Remove paths shorter than(mm)") tbox3_label.place(x=70, y=110) tBox4 = Entry(tab5, textvariable=safe_travel, width=5) tBox4.insert(0, '5') tBox4.place(x=20, y=140) tbox4_label = Label(tab5, text="Safe Travel(mm)") tbox4_label.place(x=70, y=140) tBox5 = Entry(tab5, textvariable=plunge_depth, width=5) tBox5.insert(0, '-1') tBox5.place(x=20, y=170) tbox5_label = Label(tab5, text="Plunge Depth(mm)") tbox5_label.place(x=70, y=170) master.mainloop()
class Application_ui(Frame): # 这个类仅实现界面生成功能,具体事件处理代码在子类Application中。 def __init__(self, master=None): Frame.__init__(self, master) self.master.title('樊登下载工具') self.master.geometry('850x650+400+250') self.createWidgets() def createWidgets(self): self.top = self.winfo_toplevel() self.style = Style() self.TabStrip1 = Notebook(self.top, takefocus='red') print(type(self.TabStrip1['takefocus'])) self.TabStrip1.place(relx=0.02, rely=0.005, relwidth=0.96, relheight=0.99) self.TabStrip1__Tab2 = Frame(self.TabStrip1, bg='white') tasklist_ = tasklist() tasklist_.create_tasklist_tv(self.TabStrip1__Tab2) self.TabStrip1__Tab1 = Frame(self.TabStrip1) self.home = main_page(self.TabStrip1__Tab1, tasklist_) self.TabStrip1.add(self.TabStrip1__Tab1, text='首页') self.TabStrip1.add(self.TabStrip1__Tab2, text='任务列表') def create_tasklist_tv(self, tv): canvas_frame = Frame(tv, width=500, height=400) canvas_frame.pack(fill=X) treeview = self.TabStrip1__Tab2Lbl = Treeview(tv, columns=("no", "name")) treeview.column("#0", width="0", stretch=0) treeview.column("no", width="10") treeview.column("name", width="200") treeview.heading("no", text="序号") treeview.heading("name", text="名称") self.TabStrip1__Tab2Lbl.place(relx=0.02, rely=0.005, relwidth=0.76, relheight=0.99) progress_frame = self.progress_frame = Frame(tv) progress_frame.place(relwidth=0.2, relheight=0.99, relx=0.79, rely=0.005) progress_head = Label(progress_frame, bg="white", text="进度") progress_head.pack(side=TOP, fill=X) self.TabStrip1.add(self.TabStrip1__Tab2, text='任务列表') def insert_data(self): treeview = self.TabStrip1__Tab2Lbl treeview.insert("", 1, value=("1", "你好")) treeview.insert("", 2, value=("2", "你好")) treeview.insert("", 3, value=("3", "你好")) treeview.insert("", 4, value=("4", "你好")) treeview.insert("", 5, value=("5", "你好")) treeview.insert("", 6, value=("6", "你好")) treeview.insert("", 7, value=("7", "你好")) treeview.insert("", 8, value=("8", "你好")) treeview.insert("", 9, value=("9", "你好")) treeview.insert("", 10, value=("10", "你好")) treeview.insert("", 11, value=("11", "你好")) treeview.insert("", 12, value=("12", "你好")) treeview.insert("", 13, value=("13", "你好")) treeview.insert("", 14, value=("14", "你好")) treeview.insert("", 15, value=("15", "你好")) treeview.insert("", 16, value=("16", "你好")) treeview.insert("", 17, value=("17", "你好")) treeview.insert("", 18, value=("18", "你好")) treeview.insert("", 19, value=("19", "你好")) treeview.insert("", 20, value=("20", "你好")) treeview.insert("", 21, value=("21", "你好")) treeview.insert("", 22, value=("22", "你好")) treeview.insert("", 23, value=("23", "你好")) treeview.insert("", 24, value=("24", "你好")) treeview.insert("", 25, value=("25", "你好")) treeview.insert("", 26, value=("26", "你好")) treeview.insert("", 27, value=("27", "你好")) progress = Label(self.progress_frame, bg="white", text="100%") progress.pack(side=TOP, fill=X) width_ = 200 canvas = Canvas(progress, width=width_, height=10, bg="white") canvas.place(relx=0, rely=0)
class HealslutMaster(Frame): def __init__(self,master,hyp_folders,userinfo,background_list,prefdict, Insults,Praise,*pargs): Frame.__init__(self, master, *pargs) try: self.master = master self.master.overrideredirect(1) self.SetupVars(background_list,prefdict,hyp_folders,userinfo,Insults,Praise) self.SetupMenu() self.SavePref() except Exception as e: HP.HandleError(format_exc(2), e, 'healslutmaster.init', subj='') def SetupVars(self,background_list,prefdict,hyp_folders,userinfo,Insults,Praise): self.p_hypno, self.c_hypno = Pipe() self.p_killfeed, self.c_killfeed = Pipe() self.p_Vibe, self.c_Vibe = Pipe() self.p_vid, self.c_vid = Pipe() self.p_txt, self.c_txt = Pipe() self.p_pinup, self.c_pinup = Pipe() self.p_homework, self.c_homework = Pipe() self.p_wordknt, self.c_wordknt = Pipe() self.p_CharSelect, self.c_CharSelect = Pipe() self.background_list = background_list self.background_select = StringVar(self.master) if len(background_list) < int(prefdict['background_select_var']): prefdict['background_select_var'] = 0 self.background_select_var = int(prefdict['background_select_var']) self.background_select.set(background_list[self.background_select_var]) self.screenwidth = self.master.winfo_screenwidth() self.screenheight = self.master.winfo_screenheight() self.hyp_delay = StringVar(self.master) self.hyp_delay.set(prefdict['hyp_delay']) self.hyp_game = StringVar(self.master) self.hyp_game.set(prefdict['hyp_game']) self.hyp_opacity = StringVar(self.master) self.hyp_opacity.set(prefdict['hyp_opacity']) self.hyp_homework = StringVar(self.master) self.hyp_homework.set(prefdict['hyp_homework']) self.hyp_words = StringVar(self.master) self.hyp_words.set(prefdict['hyp_words']) self.loopingAudio = StringVar(self.master) self.loopingAudio.set(prefdict['loopingAudio']) self.AudioType = StringVar(self.master) self.AudioType.set(prefdict['AudioType']) self.hyp_able = IntVar(self.master) self.hyp_able.set(int(prefdict['hyp_able'])) self.hyp_pinup = IntVar(self.master) self.hyp_pinup.set(int(prefdict['hyp_pinup'])) self.UseActionMenu = IntVar(self.master) self.UseActionMenu.set(int(prefdict['s_playing'])) self.Freeplay = IntVar(self.master) self.Freeplay.set(int(prefdict['Freeplay'])) self.hyp_banword = IntVar(self.master) self.hyp_banword.set(int(prefdict['hyp_banword'])) self.hyp_tranbanr = IntVar(self.master) self.hyp_tranbanr.set(int(prefdict['hyp_tranbanr'])) self.display_rules = IntVar(self.master) self.display_rules.set(int(prefdict['display_rules'])) self.delold = IntVar(self.master) self.delold.set(int(prefdict['delold'])) self.s_decay = StringVar(self.master) self.s_decay.set(prefdict['s_decay']) self.s_decay_pow = StringVar(self.master) self.s_decay_pow.set(prefdict['s_decay_pow']) self.hyp_dom = StringVar(self.master) self.hyp_dom.set(prefdict['hyp_dom']) self.hyp_sub = StringVar(self.master) self.hyp_sub.set(prefdict['hyp_sub']) self.FemSex = StringVar(self.master) self.FemSex.set(prefdict['FemSex']) self.fontsize = StringVar(self.master) self.fontsize.set(prefdict['fontsize']) self.HSSub = StringVar(self.master) self.HSSub.set(prefdict['sub']) self.HSDom = StringVar(self.master) self.HSDom.set(prefdict['dom']) self.UseHSBackground = IntVar(self.master) self.UseHSBackground.set(prefdict['UseHSBackground']) self.Old_UseHSBackground = int(prefdict['UseHSBackground']) if self.UseHSBackground.get() == 1: HP.HandleOSBackground(1) self.Alphabet = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] self.KillFeedPath = path.abspath('Resources\\Killfeed\\%sx%s\\Overwatch'%(self.screenwidth,self.screenheight))+'\\' self.convfolder = StringVar(self.master) self.convfolder.set(' ') self.s_rulename = StringVar(self.master) self.s_rulename.set(prefdict['s_rulename']) self.hyp_gfile = StringVar(self.master) self.hyp_gfile_var = int(prefdict['hyp_gfile_var']) self.AllCharList = ['No Images'] self.hyp_folders = hyp_folders try: self.hyp_gfile.set(hyp_folders[self.hyp_gfile_var]) except IndexError: self.hyp_gfile.set(hyp_folders[0]) self.conv_hyp_folders = hyp_folders self.textwdith = StringVar() self.textwdith.set(self.screenwidth) self.textheight = StringVar() self.textheight.set(self.screenheight) self.OverlayActive = False self.Editting = False self.RulesOkay = False self.ActionMenuOpen = False self.WSActive = False self.BaseSpeed = 0 self.VibeSpeed = 0 self.RotrSpeed = 0 self.AirSpeed = 0 self.rulesets = [] Filepath = path.abspath('Resources\\Healslut Games') for filename in iglob(Filepath+'\\*\\', recursive=True): filename = filename.split(Filepath)[-1].replace('\\','') self.rulesets.append(filename) self.rewardcycle = [] self.punishcycle = [] self.decaytimer=time() self.air_decaytimer=time() self.usermail,self.userpass,self.usersecure,self.ToEmail = HP.SetupEmail(userinfo) self.Insults = Insults self.Praise = Praise def LoadPreDict(self): Filepath = path.abspath('Resources/Healslut Games/'+self.s_rulename.get()+'/Preferences.txt') for i in glob(Filepath): self.ResetPrefDict(HP.GenUserPref(i)) def ResetPrefDict(self,prefdict): print('resetting vars') self.background_select_var = int(prefdict['background_select_var']) self.background_select.set(self.background_list[self.background_select_var]) self.hyp_delay.set(prefdict['hyp_delay']) self.hyp_game.set(prefdict['hyp_game']) self.hyp_opacity.set(prefdict['hyp_opacity']) self.hyp_homework.set(prefdict['hyp_homework']) self.hyp_words.set(prefdict['hyp_words']) self.loopingAudio.set(prefdict['loopingAudio']) self.AudioType.set(prefdict['AudioType']) self.hyp_able.set(int(prefdict['hyp_able'])) self.hyp_pinup.set(int(prefdict['hyp_pinup'])) self.UseActionMenu.set(int(prefdict['s_playing'])) self.Freeplay.set(int(prefdict['Freeplay'])) self.hyp_banword.set(int(prefdict['hyp_banword'])) self.hyp_tranbanr.set(int(prefdict['hyp_tranbanr'])) self.display_rules.set(int(prefdict['display_rules'])) self.delold.set(int(prefdict['delold'])) self.s_decay.set(prefdict['s_decay']) self.s_decay_pow.set(prefdict['s_decay_pow']) self.hyp_dom.set(prefdict['hyp_dom']) self.hyp_sub.set(prefdict['hyp_sub']) self.FemSex.set(prefdict['FemSex']) self.fontsize.set(prefdict['fontsize']) self.HSSub.set(prefdict['sub']) self.HSDom.set(prefdict['dom']) self.UseHSBackground.set(prefdict['UseHSBackground']) self.Old_UseHSBackground = int(prefdict['UseHSBackground']) self.s_rulename.set(prefdict['s_rulename']) self.hyp_gfile_var = int(prefdict['hyp_gfile_var']) def SetupMenu(self): def StartMoveMM(event): self.MMy = event.y def StopMoveMM(event): self.MMy = None def MainMenuOnMotion(event): deltay = event.y - self.MMy x = self.master.winfo_x() y = self.master.winfo_y() + deltay self.master.geometry("+%s+%s" % (x, y)) # ################################# # self.master.wm_attributes("-transparentcolor", HP.TRANS_CLR()) self.frame = Frame(self.master, width=50, height=1000,#height=270, borderwidth=2, bg=HP.TRANS_CLR(), relief=RAISED) self.frame.grid(row=0,column=0) self.bg = Label(self.frame, bg='gray30', width=50, height=270, anchor=E) self.bg.place(x=0,y=20) self.bg.grip = Label(self.frame, height=1, bg='Gray50', text="<Move>", font=('Times', 8)) self.bg.grip.place(x=0,y=0) self.bg.grip.bind("<ButtonPress-1>", StartMoveMM) self.bg.grip.bind("<ButtonRelease-1>", StopMoveMM) self.bg.grip.bind("<B1-Motion>", MainMenuOnMotion) self.BtnRwrd = Button(self.bg, bg='green',text="Rwrd",width=5,command=partial(self.HandleCycles,self.rewardcycle)) self.BtnRwrd.grid(row=1, column=0) self.BtnPnsh = Button(self.bg, bg='red', text="Pnsh", width=5,command=partial(self.HandleCycles,self.punishcycle)) self.BtnPnsh.grid(row=2, column=0) self.BtnStopVibe = Button(self.bg,text="Stop\nVibe",width=5,command=HP.StopVibe) self.BtnStopVibe.grid(row=3, column=0) self.BtnHypno = Button(self.bg,text="Start\nHypno",width=5,command=self.LaunchHypno) self.BtnHypno.grid(row=4, column=0) self.BtnEdit = Button(self.bg, text="Edit",width=5,command=self.EditHypno) self.BtnEdit.grid(row=5, column=0) self.BtnQuit = Button(self.bg, text="Quit",width=5,command=self.Shutdown) self.BtnQuit.grid(row=6, column=0) self.master.config(takefocus=1) def LaunchVibe(self): def CheckDecay(): self.RotrSpeed = 0 if self.RotrSpeed <= 0 else 100 if self.RotrSpeed >= 100 else self.RotrSpeed self.VibeSpeed = 0 if self.VibeSpeed <= 0 else 100 if self.VibeSpeed >= 100 else self.VibeSpeed if not self.s_decay == '0' and time() > self.decaytimer: sec = int(self.s_decay.get()) self.decaytimer=time()+sec # Thanks Github User this-is-embarrassing! speed_changes = \ { '-1' : lambda x: x - 1, '-3' : lambda x: x - 3, '-10': lambda x: x - 10, '-20': lambda x: x - 20, '3/4': lambda x: x * .75, '1/2': lambda x: x * .5, '1/4': lambda x: x * .25, } if self.VibeSpeed > 0 or self.RotrSpeed > 0: new_speed = speed_changes.get(self.s_decay_pow.get(), lambda x: x) self.VibeSpeed = new_speed(self.VibeSpeed) self.RotrSpeed = new_speed(self.RotrSpeed) self.RotrSpeed = int(self.RotrSpeed/5) self.VibeSpeed = int(self.VibeSpeed/5) if not self.s_decay == '0' and time() > self.air_decaytimer: self.air_decaytimer=time()+int(self.s_decay.get())*3 self.AirSpeed -= 1 self.AirSpeed = 0 if self.AirSpeed < 0 else 3 if self.AirSpeed > 3 else self.AirSpeed def vibeloop(): try: if not self.c_Vibe.poll(): if self.hyp_game.get() == 'OW': im = screenshot() self.markslist, self.BaseSpeed = OWVibe.go(self.Positions,self.markslist,im) OWKillfeedMonitor.Main(im,self.KillFeedFiles, self.HSSub.get(),self.HSDom.get(),self.Cords, self.c_killfeed,self.KillFeedPath,self.BorderPixels) if self.p_killfeed.poll() == True: self.HandleCycles(self.KillfeedCycleDict[self.p_killfeed.recv()]) if self.hyp_game.get() == 'LoL': Filepath = path.abspath('Resources/Killfeed/%sx%s/LOL'%(self.screenwidth,self.screenheight))+'/' LoLKillfeedMonitor.SubDeath(Filepath,self.c_killfeed) if self.p_killfeed.poll() == True: print('Killfeed event detected!') self.HandleCycles(self.KillfeedCycleDict[self.p_killfeed.recv()]) #if self.hyp_game.get() == 'WoW': #Stuff vibespeed = self.BaseSpeed+self.VibeSpeed rotrspeed = self.BaseSpeed+self.RotrSpeed if self.BaseSpeed > 70: self.p_wordknt.send(6) else: self.p_wordknt.send(self.wordcountInt) CheckDecay() print('Vibe: %s, Rotate: %s'%(vibespeed,rotrspeed), end="\r") if not self.c_Vibe.poll(): #This is the area where we will communicate to the b******g server for url in [URL+'Vibrate?v=%s'%(vibespeed),URL+'RotateAntiClockwise?v=%s'%(rotrspeed),URL+'AirAuto?v=%s'%(self.AirSpeed)]: if self.OverlayActive and not self.c_Vibe.poll(): #a chance to break midway through Thread(target=HP.DoRequest, args=(url,1)).start() if self.OverlayActive: self.after(2500, vibeloop) except Exception as e: HP.HandleError(format_exc(2), e, 'vibeloop', subj='') def SelectLoop(): xFound = OWVibe.CheckLoadingScreen(self.p_CharSelect) if self.OverlayActive: if xFound == True: print('Found it') self.after(300000, SelectLoop) else: self.after(500, SelectLoop) # ################################# # try: if HSDEBUG: print('Clearing Vibe Pipe') while self.c_Vibe.poll() == True: self.c_Vibe.recv() if self.hyp_game.get() == 'OW': self.markslist = [0,0,0,0] self.Positions = OWVibe.GenPositions() self.Cords, self.BorderPixels = OWKillfeedMonitor.GenCords(self) if self.Freeplay.get() == True: self.KillFeedFiles = glob(self.KillFeedPath+'*.png') else: self.KillFeedFiles = \ [ path.abspath(self.KillFeedPath+self.HSSub.get()+'.png'), path.abspath(self.KillFeedPath+self.HSSub.get()+' Assist.png'), path.abspath(self.KillFeedPath+self.HSDom.get()+'.png') ] if HSDEBUG: print('Launching vibeloop') vibeloop() #SelectLoop() #$ character select loop, will be used with banner one day except Exception as e: HP.HandleError(format_exc(2), e, 'LaunchVibe', subj='') def LaunchHypno(self): try: if self.Editting == True: self.DestroyActions() if self.OverlayActive == False: self.BtnHypno.config(text='End\nHypno') self.OverlayActive = True self.RulesOkay = False while self.c_hypno.poll() == True: self.c_hypno.recv() delay = int(self.hyp_delay.get()) opacity = int(self.hyp_opacity.get()) game = str(self.hyp_game.get()) homework = str(self.hyp_homework.get()) hypno = self.hyp_able.get() wordcount = str(self.hyp_words.get()) if wordcount == 'None': wordcount = 0 elif wordcount == 'Low': wordcount = 1 elif wordcount == 'Medium': wordcount = 2 elif wordcount == 'High': wordcount = 3 elif wordcount == 'Very High': wordcount = 4 elif wordcount == 'Max': wordcount = 5 elif wordcount == 'Unlimited': wordcount = 6 self.wordcountInt = wordcount dom = str(self.hyp_dom.get()) sub = str(self.hyp_sub.get()) pinup = self.hyp_pinup.get() banwords = self.hyp_banword.get() tranbanr = self.hyp_tranbanr.get() globfile = path.abspath(self.hyp_gfile.get()) s_rulename = self.s_rulename.get() fontsize = self.fontsize.get() display_rules = self.display_rules.get() loopingAudio = self.loopingAudio.get() if loopingAudio == 'None': loopingAudio = 0 elif loopingAudio == 'List': loopingAudio = 1 elif loopingAudio == 'Shuffle': loopingAudio = 2 AudioType = self.AudioType.get() gifset = self.background_select.get().replace('.gif','') FemSex = str(self.FemSex.get()) StartHypnoProcess(delay,opacity,game, homework,wordcount,hypno,dom,sub,pinup,banwords,tranbanr, globfile,s_rulename,fontsize,display_rules,loopingAudio,AudioType, gifset,FemSex,self.c_vid,self.c_txt,self.c_pinup,self.c_homework, self.c_wordknt,self.c_CharSelect,self.c_hypno) self.EstablishRules() self.LaunchVibe() else: self.DestroyActions() except Exception as e: HP.HandleError(format_exc(2), e, 'LaunchHypno', subj='') def EstablishRules(self): def GenButtonLines(rulefilename): Filepath = path.abspath('Resources\\Healslut Games\\'+rulefilename) with open(Filepath, 'r') as f: self.templines = f.readlines() if '.jpg' in self.templines[0].replace('\n',''): icon = self.templines[0].replace('\n','') self.templines.remove(self.templines[0]) else: icon = '' return icon, self.templines, cycle(self.templines) # ###################################### # try: if self.RulesOkay == False: self.ActiveEmailWarning = False iterlist = [] try: self.rwdicon, rewardlist, self.rewardcycle = GenButtonLines(self.s_rulename.get()+'/Rewards.txt') self.punicon, punishlist, self.punishcycle = GenButtonLines(self.s_rulename.get()+'/Punishments.txt') iterlist.append(rewardlist) iterlist.append(punishlist) self.BtnRwrd.config(command=partial(self.HandleCycles,self.rewardcycle)) self.BtnPnsh.config(command=partial(self.HandleCycles,self.punishcycle)) except IndexError: pass self.KillfeedCycleDict = {} try: if self.hyp_game.get() == 'OW': _, kfAsstList, self.kfAsstCycle = GenButtonLines(self.s_rulename.get()+'/DeathAssist.txt') iterlist.append(kfAsstList) self.KillfeedCycleDict['Assist'] = self.kfAsstCycle _, kfDomsList, self.kfDomsCycle = GenButtonLines(self.s_rulename.get()+'/DeathDom.txt') iterlist.append(kfDomsList) self.KillfeedCycleDict['DomDeath'] = self.kfDomsCycle _, kfKillList, self.kfKillCycle = GenButtonLines(self.s_rulename.get()+'/DeathKill.txt') iterlist.append(kfKillList) self.KillfeedCycleDict['Kill'] = self.kfKillCycle _, kfSubsList, self.kfSubsCycle = GenButtonLines(self.s_rulename.get()+'/DeathSub.txt') iterlist.append(kfSubsList) self.KillfeedCycleDict['SubDeath'] = self.kfSubsCycle _, kfTeamList, self.kfTeamCycle = GenButtonLines(self.s_rulename.get()+'/DeathTeam.txt') iterlist.append(kfTeamList) self.KillfeedCycleDict['TeamDeath'] = self.kfTeamCycle elif self.hyp_game.get() == 'LoL': _, kfSubsList, self.kfSubsCycle = GenButtonLines(self.s_rulename.get()+'/DeathSub.txt') iterlist.append(kfSubsList) self.KillfeedCycleDict['SubDeath'] = self.kfSubsCycle except IndexError: pass except FileNotFoundError: pass if self.UseActionMenu.get() == 1: try: FirstIconFound = False self.IconA, ActionListA, self.ActionCycleA = GenButtonLines(self.s_rulename.get()+'/ButtonA.txt') FirstIconFound = True iterlist.append(ActionListA) self.IconB, ActionListB, self.ActionCycleB = GenButtonLines(self.s_rulename.get()+'/ButtonB.txt') iterlist.append(ActionListB) self.IconC, ActionListC, self.ActionCycleC = GenButtonLines(self.s_rulename.get()+'/ButtonC.txt') iterlist.append(ActionListC) self.IconD, ActionListD, self.ActionCycleD = GenButtonLines(self.s_rulename.get()+'/ButtonD.txt') iterlist.append(ActionListD) self.IconE, ActionListE, self.ActionCycleE = GenButtonLines(self.s_rulename.get()+'/ButtonE.txt') iterlist.append(ActionListE) self.IconF, ActionListF, self.ActionCycleF = GenButtonLines(self.s_rulename.get()+'/ButtonF.txt') iterlist.append(ActionListF) self.IconG, ActionListG, self.ActionCycleG = GenButtonLines(self.s_rulename.get()+'/ButtonG.txt') iterlist.append(ActionListG) self.IconH, ActionListH, self.ActionCycleH = GenButtonLines(self.s_rulename.get()+'/ButtonH.txt') iterlist.append(ActionListH) self.IconI, ActionListI, self.ActionCycleI = GenButtonLines(self.s_rulename.get()+'/ButtonI.txt') iterlist.append(ActionListI) self.IconJ, ActionListJ, self.ActionCycleJ = GenButtonLines(self.s_rulename.get()+'/ButtonJ.txt') iterlist.append(ActionListJ) except FileNotFoundError as e: pass except Exception as e: print(e) for list in iterlist: for line in list: self.CheckForPictue(line) self.RulesOkay = True self.BuildActionMenu() except Exception as e: HP.HandleError(format_exc(2), e, 'EstablishRules', subj='') def EditHypno(self): def UpdateEditMenu(): try: if self.Editting == True: if self.gifcanvas: self.gifcanvas.itemconfig(self.gifpreview, image=next(self.GifCycle)) if self.hyp_able.get() == 2: self.hyp_pinup.set(0) self.EnablePinups.configure(state=DISABLED) else: self.EnablePinups.configure(state=NORMAL) if self.hyp_game.get() == 'OW': self.optSub.configure(state=NORMAL) self.optDom.configure(state=NORMAL) self.chkFP.configure(state=NORMAL) else: self.optSub.configure(state=DISABLED) self.optDom.configure(state=DISABLED) self.chkFP.configure(state=DISABLED) if self.c_hypno.poll() == False: self.p_hypno.send(True) self.after(25, UpdateEditMenu) except AttributeError as e: print('Gif Preview failed.') print('Please configure the Width and Height and press Format Gifs ') except Exception as e: HP.HandleError(format_exc(2), e, 'UpdateEditMenu', subj='') def CloseEditMenu(): try: self.Editting = False self.EditMenu.destroy() except Exception as e: HP.HandleError(format_exc(2), e, 'CloseEditMenu', subj='') # ###################################################### # try: if self.OverlayActive == False and self.Editting == False: self.Editting = True if self.c_hypno.poll() == True: self.c_hypno.recv() self.EditMenu = Toplevel() self.EditMenu.title("HypnoTherapy Settings") self.EditMenu.overrideredirect(True) width, height = 1200,415 x = (self.screenwidth / 2) - (width / 2) y = (self.screenheight / 2) - (height / 2) self.EditMenu.geometry('%dx%d+%d+%d'%(width, height, x, y)) self.note = Notebook(self.EditMenu) self.tab1 = Frame(self.note, width=width-100, height=height-100, borderwidth=0, relief=RAISED) self.tab2 = Frame(self.note) self.tab3 = Frame(self.note) self.SetupTab1() self.SetupTab2() self.SetupTab3() self.note.add(self.tab1, text = "Background and Pinup") self.note.add(self.tab2, text = "Rules and Games") self.note.add(self.tab3, text = "Text and Vibrator") self.note.place(x=50,y=0) # Paypal box self.bgPaypal = Label(self.EditMenu, bg='gray75') self.bgPaypal.place(x=10,y=height-65) msg = Label(self.bgPaypal, width=22, text='Play Support on Paypal') msg.grid(row=0, column=0, columnspan=2, sticky=E+W) w = Text(self.bgPaypal, height=1, width=22, borderwidth=0, font=('Times', 14)) w.insert(1.0, '*****@*****.**') w.grid(row=1, columnspan=2) w.configure(state=DISABLED) # Exit button Button(self.EditMenu, text="Dismiss", command=CloseEditMenu).place(x=width-115,y=height-65) self.after(25, UpdateEditMenu) else: if self.OverlayActive: self.after(25, self.EditHypno) self.DestroyActions() except Exception as e: HP.HandleError(format_exc(2), e, 'EditHypno', subj='') def SetupTab1(self): def GenGifCycle(event=None): self.gifcyclist = [] i = self.background_select.get().replace('.gif','').split('\\')[-1] Filepath = 'Resources\\Hypno Gif\\'+i+'\\*.gif' for myimage in sorted(glob(Filepath, recursive=True)): self.gifcyclist.append(ImageTk.PhotoImage(Image.open(myimage).resize((250, 250), Image.LANCZOS))) self.GifCycle = cycle(self.gifcyclist) def HandleImgConvert(): print('Converting Images...') folder = self.convfolder.get() if folder == 'All': for folder in self.hyp_folders: if not folder == 'All': HP.ConvertImg(folder,self.delold.get(), self.screenwidth,self.screenheight) else: HP.ConvertImg(folder,self.delold.get(), self.screenwidth,self.screenheight) print('Done.') def FormatGifs(): print('Formatting Gifs...') mywidth,myheight = int(self.textwdith.get()),int(self.textheight.get()) Filepath = path.abspath('Resources\\Background Gif Original') HP.ExtractFrames(mywidth,myheight,Filepath) self.background_list = HP.GenBackgroundList() print('Done.') # ########################### # # #Handle Gif# # self.handlegif = Canvas(self.tab1, bg='gray50',width=250, height=300) self.handlegif.place(x=15,y=5) OptionMenu(self.handlegif, self.background_select, *self.background_list,command=GenGifCycle).place(x=15,y=7) self.gifcanvas = Canvas(self.handlegif, width=250, height=250, bg='gray75') self.gifcanvas.place(x=0,y=50) GenGifCycle() try: self.gifpreview = self.gifcanvas.create_image(1,1,image=next(self.GifCycle), anchor=NW) except StopIteration: Label(self.gifcanvas,width=25,font=('Times',12),text='!Format Gif Before Running',anchor=W,bg='gray75').place(x=0,y=0) # #Format gif# # self.bggif = Label(self.tab1, bg='gray50',width=300) self.bggif.place(x=870,y=240) Label(self.bggif, width=6, font=('Times', 12),text='Width', anchor=W).grid(row=0,column=0, pady=2) Label(self.bggif, width=6, font=('Times', 12),text='Height', anchor=W).grid(row=1,column=0, pady=2) Entry(self.bggif, width=5, borderwidth=0, font=('Times', 14), textvariable=self.textwdith).grid(row=0,column=1) Entry(self.bggif, width=5, borderwidth=0, font=('Times', 14), textvariable=self.textheight).grid(row=1,column=1) Button(self.bggif, text="Format Gifs", command=FormatGifs).grid(row=1,column=2) # Convert png # self.bgConvert = Label(self.tab1, bg='gray50',width=30,height=4) self.bgConvert.place(x=500,y=240) Button(self.bgConvert, text="Convert jpg to png", command=HandleImgConvert).place(x=1,y=1) Checkbutton(self.bgConvert, text="Delete jpgs", variable=self.delold).place(x=138,y=2) OptionMenu(self.bgConvert, self.convfolder, *self.conv_hyp_folders).place(x=1,y=35) # ############ # Message(self.tab1, text='Overlay Opacity').place(x=300,y=25) Message(self.tab1, text='Cycle Delay').place(x=300,y=75) Message(self.tab1, text='Image Folder').place(x=300,y=125) OptionMenu(self.tab1, self.hyp_opacity, '0', '1', '2', '3', '4').place(x=400,y=25) OptionMenu(self.tab1, self.hyp_delay, '250', '500', '1000', '1500', '3000').place(x=400,y=75) OptionMenu(self.tab1, self.hyp_gfile, *self.hyp_folders).place(x=400,y=125) Radiobutton(self.tab1, text="None", variable=self.hyp_able,value=0).place(x=300,y=200) Radiobutton(self.tab1, text="Hypno Background", variable=self.hyp_able,value=1).place(x=300,y=225) Radiobutton(self.tab1, text="Turbo Hypno", variable=self.hyp_able,value=2).place(x=300,y=250) self.EnablePinups = Checkbutton(self.tab1, text="Enable Pinups", variable=self.hyp_pinup) self.EnablePinups.place(x=300,y=275) # has to be an object Checkbutton(self.tab1, text="Healslut Desktop Background", variable=self.UseHSBackground).place(x=800,y=50) def SetupTab2(self): def GenKillfeedList(): AllCharList = [] for i in glob(self.KillFeedPath+'*.png'): if not 'Assist' in i: AllCharList.append(i.replace(self.KillFeedPath,'').replace('.png','')) if not AllCharList == []: self.AllCharList = AllCharList # ############################# # owlvl = 250 Message(self.tab2, text='Rule set').place(x=25,y=20) Message(self.tab2, text='Rule Font Size').place(x=25,y=120) Message(self.tab2, text='Game',aspect=200).place(x=25,y=170) Button(self.tab2, text="Load Premade Rules", command=self.LoadPreDict).place(x=40,y=70) OptionMenu(self.tab2, self.s_rulename, *self.rulesets).place(x=125,y=20) OptionMenu(self.tab2, self.fontsize, '12', '18', '20', '24', '30').place(x=125,y=120) OptionMenu(self.tab2, self.hyp_game, 'None', 'OW', 'LoL').place(x=125,y=170) GenKillfeedList() Message(self.tab2, text='Sub Character').place(x=25,y=owlvl) Message(self.tab2, text='Dom Character').place(x=300,y=owlvl) self.optSub = OptionMenu(self.tab2, self.HSSub, *self.AllCharList) self.optDom = OptionMenu(self.tab2, self.HSDom, *self.AllCharList) self.chkFP = Checkbutton(self.tab2, text="Freeplay", variable=self.Freeplay) self.optSub.place(x=125,y=owlvl) self.optDom.place(x=400,y=owlvl) self.chkFP.place(x=550,y=owlvl+5) Radiobutton(self.tab2, text="No Rules", variable=self.display_rules,value=0).place(x=300,y=75) Radiobutton(self.tab2, text="Transparent Rules", variable=self.display_rules,value=1).place(x=300,y=100) Radiobutton(self.tab2, text="Opaque Rules", variable=self.display_rules,value=2).place(x=300,y=125) Checkbutton(self.tab2, text="Use ActionMenu", variable=self.UseActionMenu).place(x=300,y=150) def SetupTab3(self): Message(self.tab3, text='Dom Gender' ).place(x=25, y=20) Message(self.tab3, text='Self Gender' ).place(x=25, y=70) Message(self.tab3, text='Sex' ).place(x=25, y=120) Message(self.tab3, text='Write For Me' ).place(x=300, y=20) Message(self.tab3, text='Word Count' ).place(x=300, y=70) Message(self.tab3, text='Looping Audio' ).place(x=575, y=20) Message(self.tab3, text='Track Type' ).place(x=575, y=70) Message(self.tab3, text='Speed Decay Timer' ).place(x=800,y=20) Message(self.tab3, text='Speed Decay Strengh' ).place(x=800,y=70) OptionMenu( self.tab3, self.hyp_dom, "None", "Male", "Female").place(x=125,y=20) OptionMenu( self.tab3, self.hyp_sub, "Sub", "Boy", "Girl").place(x=125,y=70) OptionMenu( self.tab3, self.FemSex, "None", "Bimbo", "Sissy").place(x=125,y=120) OptionMenu( self.tab3, self.hyp_homework, "Never", "Not Often", "Often", "Very Often", "Always", "Banner").place(x=400,y=20) OptionMenu( self.tab3, self.hyp_words, "None", "Low", "Medium", "High", "Very High", "Max", "Unlimited").place(x=400,y=70) OptionMenu( self.tab3, self.loopingAudio, "None", "List", "Shuffle").place(x=675,y=20) OptionMenu( self.tab3, self.AudioType, "Either", "Music", "Spoken").place(x=675,y=70) OptionMenu( self.tab3, self.s_decay, '0', '3', '10', '30', '45', '60', '75', '90').place(x=900,y=20) OptionMenu( self.tab3, self.s_decay_pow, '0', '-1', '-3', '-10', '-20', '3/4', '1/2', '1/4').place(x=900,y=70) Checkbutton(self.tab3, text="Transparent Banner", variable=self.hyp_tranbanr).place(x=350,y=150) Checkbutton(self.tab3, text="Transparent Words", variable=self.hyp_banword).place(x=350,y=175) ######################### # Begin Buttons Manager # ######################### def BuildActionMenu(self): def GenButtonImage(filename): Filepath = path.abspath('Resources\\Buttonlabels\\'+filename) tempphoto = Image.open(Filepath) tempphoto = tempphoto.resize((50, 50), Image.LANCZOS) return ImageTk.PhotoImage(tempphoto) def StartMoveAM(event): self.AMx, self.AMy = event.x, event.y def StopMoveAM(event): self.AMx,self.AMy = None, None def ActionMenuOnMotion(event): x = self.ActionMenu.winfo_x() + event.x - self.AMx y = self.ActionMenu.winfo_y() + event.y - self.AMy self.ActionMenu.geometry("+%s+%s" % (x, y)) # ##################################### # if self.ActionMenuOpen == False and self.UseActionMenu.get() == 1: Filepath = path.abspath('Resources/Healslut Games/'+self.s_rulename.get()+'/ButtonA.txt') if path.isfile(Filepath): self.ActionMenuOpen = True self.ActionMenu = Toplevel(self, bg=HP.TRANS_CLR(), highlightthickness=0) self.ActionMenu.overrideredirect(True) self.ActionMenu.wm_attributes("-topmost", 1) self.ActionMenu.wm_attributes("-transparentcolor", HP.TRANS_CLR()) self.ActionFrame = Frame(self.ActionMenu, width=50, height=50, bg=HP.TRANS_CLR(), borderwidth=0, relief=RAISED,) self.ActionFrame.grid(row=0,column=0) # MOVING GRIP self.grip = Label(self.ActionFrame, height=1, bg='Gray50', text="< Hold to Move >", font=('Times', 8)) self.grip.grid(row=0,column=0,columnspan=2) self.grip.bind("<ButtonPress-1>", StartMoveAM) self.grip.bind("<ButtonRelease-1>", StopMoveAM) self.grip.bind("<B1-Motion>", ActionMenuOnMotion) x = (self.screenwidth -300) y = (self.screenheight *.4) self.ActionMenu.geometry('%dx%d+%d+%d' % (115, 310, x, y)) if not self.rwdicon == '': self.imageRwd = GenButtonImage(self.rwdicon) self.BtnRwrd.config(image=self.imageRwd,bd=0,highlightthickness=0) if not self.punicon == '': self.imagePun = GenButtonImage(self.punicon) self.BtnRwrd.config(image=self.imageRwd,bd=0,highlightthickness=0) self.BtnRwrd.config(command=partial(self.HandleCycles,self.rewardcycle)) self.BtnPnsh.config(command=partial(self.HandleCycles,self.punishcycle)) try: self.imageA = GenButtonImage(self.IconA) self.ButtonA = Button(self.ActionFrame, image=self.imageA, text="A", command=partial(self.HandleCycles,self.ActionCycleA)).grid(row=1,column=0,sticky=W+E+N+S) self.imageB = GenButtonImage(self.IconB) self.ButtonB = Button(self.ActionFrame, image=self.imageB, text="A", command=partial(self.HandleCycles,self.ActionCycleB)).grid(row=1,column=1,sticky=W+E+N+S) self.imageC = GenButtonImage(self.IconC) self.ButtonC = Button(self.ActionFrame, image=self.imageC, text="A", command=partial(self.HandleCycles,self.ActionCycleC)).grid(row=2,column=0,sticky=W+E+N+S) self.imageD = GenButtonImage(self.IconD) self.ButtonD = Button(self.ActionFrame, image=self.imageD, text="A", command=partial(self.HandleCycles,self.ActionCycleD)).grid(row=2,column=1,sticky=W+E+N+S) self.imageE = GenButtonImage(self.IconE) self.ButtonE = Button(self.ActionFrame, image=self.imageE, text="A", command=partial(self.HandleCycles,self.ActionCycleE)).grid(row=3,column=0,sticky=W+E+N+S) self.imageF = GenButtonImage(self.IconF) self.ButtonF = Button(self.ActionFrame, image=self.imageF, text="A", command=partial(self.HandleCycles,self.ActionCycleF)).grid(row=3,column=1,sticky=W+E+N+S) self.imageG = GenButtonImage(self.IconG) self.ButtonG = Button(self.ActionFrame, image=self.imageG, text="A", command=partial(self.HandleCycles,self.ActionCycleG)).grid(row=4,column=0,sticky=W+E+N+S) self.imageH = GenButtonImage(self.IconH) self.ButtonH = Button(self.ActionFrame, image=self.imageH, text="A", command=partial(self.HandleCycles,self.ActionCycleH)).grid(row=4,column=1,sticky=W+E+N+S) self.imageI = GenButtonImage(self.IconI) self.ButtonI = Button(self.ActionFrame, image=self.imageI, text="A", command=partial(self.HandleCycles,self.ActionCycleI)).grid(row=5,column=0,sticky=W+E+N+S) self.imageJ = GenButtonImage(self.IconJ) self.ButtonJ = Button(self.ActionFrame, image=self.imageJ, text="A", command=partial(self.HandleCycles,self.ActionCycleJ)).grid(row=5,column=1,sticky=W+E+N+S) except Exception as e: pass def CheckForPictue(self,line): def ConfigCamInfo(): Filepath = path.abspath('Resources\\Cam Info.txt') with open(Filepath, 'r') as f: Lines = f.read().split('\n') with open(Filepath, 'w') as f: for line in Lines: if not line == '0': f.write(line+'\n') else: f.write('1''\n') self.usersecure = '1' self.win.destroy() def EmailWarning(): try: self.win = Toplevel() self.win.wm_title("Picture Email Enabler") width, height = 900,100 x = (self.screenwidth / 2) - (width / 2) y = (self.screenheight / 2) - (height / 2) self.win.geometry('%dx%d+%d+%d' % (width, height, x, y)) bg = Label(self.win, bg='gray75', width=500, height=50) bg.pack(fill=X, expand=YES) msg = Label(bg, width=20, font=('Times', 12), text='To use the $picture function, enable less secure access in the following link. See README.txt for more') msg.pack(fill=X, expand=YES) w = Text(bg, height=1, width=21, borderwidth=0, font=('Times', 14)) w.insert(1.0, 'https://myaccount.google.com/lesssecureapps') w.pack(fill=X, expand=YES) w.configure(state=DISABLED) Button(self.win, text="I've done it, please dont show this again.", command=ConfigCamInfo).pack() except Exception as e: HP.HandleError(format_exc(2), e, 'popup_bonus', subj='') # ################################### # if '$picture' in line: if not self.usersecure == '1': if self.ActiveEmailWarning == False: self.ActiveEmailWarning = True EmailWarning() def WordSearchFrame(self): def ScrambleGrid(): grid=self.WordSearchGrid SavedCords=self.WordSearchSavedCords if self.WSActive == True: width, height = WordSearch.GenDimensions(self.WordList,self.Difficulty) grid = WordSearch.GenBlankGrid(self.Difficulty,width,height,SavedCords) self.WSFrame.bg.itemconfig(self.WordSearchBG, text="\n".join(map(lambda row: " ".join(row), grid))) self.after(30000, ScrambleGrid) def StartMoveWS(event): self.WSx, self.WSy = event.x, event.y def StopMoveWS(event): self.WSx,self.WSy = None, None def WordSearchOnMotion(event): x = self.WSFrame.winfo_x() + event.x - self.WSx y = self.WSFrame.winfo_y() + event.y - self.WSy self.WSFrame.geometry("+%s+%s" % (x, y)) # ####################### # while True: try: width, height = 800,738 WordList = HP.GenWordSearchList(self.Difficulty) grid,SavedCords = WordSearch.Main(WordList,self.Difficulty) self.WSFrame = Toplevel(self, bg=HP.TRANS_CLR(), highlightthickness=0) self.WSFrame.wm_title("Word Search") self.WSFrame.overrideredirect(True) self.WSFrame.wm_attributes("-topmost", 1) self.WSFrame.wm_attributes("-transparentcolor", HP.TRANS_CLR()) x = (self.screenwidth / 2) - (width / 2) y = (self.screenheight / 2) - (height / 2) self.WSFrame.geometry('%dx%d+%d+%d' % (width, height, x, y)) # MOVING GRIP self.grip = Label(self.WSFrame, height=1, bg='Gray50', text="< Hold to Move >", font=('Times', 8)) self.grip.pack(fill=X) self.grip.bind("<ButtonPress-1>", StartMoveWS) self.grip.bind("<ButtonRelease-1>", StopMoveWS) self.grip.bind("<B1-Motion>", WordSearchOnMotion) FontColor = 'pink' self.WSFrame.bg = Canvas(self.WSFrame, bg='light blue', width=300, height=height*2) self.WSFrame.bg.pack(fill=X) WordListStr1 = '\n\n\n' WordListStr2 = '' Filepath = path.abspath('Resources/ButtonLabels/Misc/WordSearchBackgroundDark.png') image = Image.open(Filepath) self.WordSearchImg = ImageTk.PhotoImage(image) self.WordSearchBackground = self.WSFrame.bg.create_image(width/2, height/2, image=self.WordSearchImg) for word in WordList[0:int(len(WordList)*.5)]: WordListStr1 += word+'\n' for word in WordList[int(len(WordList)*.5):-1]: WordListStr2 += word+'\n' WordListStr2+='\n\n\n' self.WSFrame.bg.create_text((5,height/2), font=('Impact', 14), text=WordListStr1, fill=FontColor, justify=LEFT, anchor=W) self.WSFrame.bg.create_text((width-5,height/2), font=('Impact', 14), text=WordListStr2, fill=FontColor, justify=RIGHT, anchor=E) self.WordSearchBG = self.WSFrame.bg.create_text((width/2,height/2), fill='#FF7FED', font=("Courier", 16, "bold"), text="\n".join(map(lambda row: " ".join(row), grid))) self.WordSearchGrid=grid self.WordSearchSavedCords=SavedCords self.WordList=WordList break except Exception as e: HP.HandleError(format_exc(2), e, 'WordSearchFrame', subj='') self.after(15000, ScrambleGrid) def HandleCycles(self,mycycle): def do_macro(macro): if '$playsound' in macro: file = macro.replace('$playsound ','') try: Filepath = path.abspath('Resources\\Audio\\'+file) playsound(Filepath, False) except PlaysoundException: print(file, 'not found in Resources\\Audio\\') if '$playvideo' in macro: file = macro.replace('$playvideo ','') Filepath = path.abspath('Resources\\Video\\'+file) self.p_vid.send(Filepath) if '$text' in macro: macro=macro+' ' text = macro.replace('$text','').upper() self.p_txt.send(text) if '$RandText' in macro: text = macro.replace('$RandText-','').upper() if 'INSULT' in text: line = HP.SetWrittenLine(self.Insults,self.hyp_dom.get(),self.hyp_sub.get(),self.FemSex.get()) text = text.replace('INSULT','')+' '+line elif 'PRAISE' in text: line = HP.SetWrittenLine(self.Praise,self.hyp_dom.get(),self.hyp_sub.get(),self.FemSex.get()) text = text.replace('PRAISE','')+' '+line self.p_txt.send(text) if '$+vibe' in macro: self.VibeSpeed += int(macro.replace('$+vibe','')) if '$-vibe' in macro: self.VibeSpeed -= int(macro.replace('$-vibe','')) if '$+rotate' in macro: self.RotrSpeed += int(macro.replace('$+rotate','')) if '$-rotate' in macro: self.RotrSpeed -= int(macro.replace('$-rotate','')) if '$+air' in macro: self.AirSpeed += int(macro.replace('$+air','')) if '$-air' in macro: self.AirSpeed -= int(macro.replace('$-air','')) if '$pinup' in macro: Filepath = path.abspath('Resources\\Images\\'+macro.replace('$pinup ',''))+'\\' self.p_pinup.send(Filepath) if '$picture' in macro: Thread(target=HP.TakePic, args=(self.usermail, self.userpass, self.ToEmail)).start() if '$writeforme' in macro: homeworkcount = int(macro.replace('$writeforme','')) print(homeworkcount) self.p_homework.send(homeworkcount) if '$wordsearch' in macro: self.Difficulty = macro.replace('$wordsearch ','').upper() if self.WSActive == True: self.WSActive = False try: self.WSFrame.destroy() except AttributeError: pass else: self.WSActive = True self.WordSearchFrame() if '$diceroll' in macro: Dice = macro.replace('$diceroll','').upper() text,sep,tail = Dice.partition(' ') count,sep,die = tail.partition('D') for i in range(int(count)): text = text+' '+str(self.Alphabet[-i+1])+':'+str(randint(1,int(die))) self.p_txt.send(text) # ########################################## # try: cyc = next(mycycle) line = str(cyc).split(',') for macro in line: do_macro(macro.replace('\n','')) except Exception as e: try: HP.HandleError(format_exc(2), e, 'HandleCycles', subj=[k for k,v in locals().items() if v == mycycle][0]) except Exception as e: HP.HandleError(format_exc(2), e, 'DumbCyclesString', subj='Failed to iterate locals') def DestroyActions(self,Exit=False): if self.Editting or self.OverlayActive or Exit: self.Editting = False self.ActionMenuOpen = False self.WSActive = False self.OverlayActive = False self.BtnHypno.config(text='Start\nHypno') if self.c_Vibe.poll() == False: self.p_Vibe.send(True) if self.c_hypno.poll() == False: self.p_hypno.send(True) try: self.ActionMenu.destroy() except AttributeError: pass try: self.WSFrame.destroy() except AttributeError: pass try: self.EditMenu.destroy() except AttributeError: pass def SavePref(self): self.hyp_gfile_var = 0 for item in self.hyp_folders: if item == self.hyp_gfile.get(): break self.hyp_gfile_var +=1 self.background_select_var = 0 for item in self.background_list: if item == self.background_select.get(): break self.background_select_var +=1 PrefDictList = [ 'hyp_delay:'+str(self.hyp_delay.get()), 'hyp_game:'+str(self.hyp_game.get()), 'hyp_opacity:'+str(self.hyp_opacity.get()), 'hyp_homework:'+str(self.hyp_homework.get()), 'hyp_words:'+str(self.hyp_words.get()), 'loopingAudio:'+str(self.loopingAudio.get()), 'AudioType:'+str(self.AudioType.get()), 'hyp_able:'+str(self.hyp_able.get()), 'hyp_pinup:'+str(self.hyp_pinup.get()), 's_playing:'+str(self.UseActionMenu.get()), 'Freeplay:'+str(self.Freeplay.get()), 'hyp_banword:'+str(self.hyp_banword.get()), 'hyp_tranbanr:'+str(self.hyp_tranbanr.get()), 'display_rules:'+str(self.display_rules.get()), 'delold:'+str(self.delold.get()), 's_decay:'+str(self.s_decay.get()), 's_decay_pow:'+str(self.s_decay_pow.get()), 'hyp_dom:'+str(self.hyp_dom.get()), 'hyp_sub:'+str(self.hyp_sub.get()), 'FemSex:'+str(self.FemSex.get()), 'fontsize:'+str(self.fontsize.get()), 'hyp_gfile_var:'+str(self.hyp_gfile_var), 'background_select_var:'+str(self.background_select_var), 's_rulename:'+str(self.s_rulename.get()), 'sub:'+str(self.HSSub.get()), 'dom:'+str(self.HSDom.get()), 'UseHSBackground:'+str(self.UseHSBackground.get()) ] Filepath = path.abspath('Resources\\Preferences.txt') with open(Filepath, 'w') as f: for line in PrefDictList: f.write(line+'\n') def Shutdown(self): try: self.SavePref() if self.Old_UseHSBackground == 1 or self.UseHSBackground.get() == 1: HP.HandleOSBackground('Exit') self.DestroyActions(True) self.master.quit() except Exception as e: HP.HandleError(format_exc(2), e, 'Shutdown', subj='')
def __init__(self, root): self.root = root self.root.title("Contact Management") self.root.geometry("450x600") self.root.iconbitmap("logo235.ico") self.root.resizable(0, 0) names = StringVar() contacts = StringVar() ids = StringVar() sid = StringVar() def on_enter1(e): button_see_contacts['background'] = "black" button_see_contacts['foreground'] = "cyan" def on_leave1(e): button_see_contacts['background'] = "SystemButtonFace" button_see_contacts['foreground'] = "SystemButtonText" def on_enter2(e): button_clear_tree['background'] = "black" button_clear_tree['foreground'] = "cyan" def on_leave2(e): button_clear_tree['background'] = "SystemButtonFace" button_clear_tree['foreground'] = "SystemButtonText" def on_enter3(e): but_add['background'] = "black" but_add['foreground'] = "cyan" def on_leave3(e): but_add['background'] = "SystemButtonFace" but_add['foreground'] = "SystemButtonText" def on_enter4(e): but_edit['background'] = "black" but_edit['foreground'] = "cyan" def on_leave4(e): but_edit['background'] = "SystemButtonFace" but_edit['foreground'] = "SystemButtonText" def on_enter5(e): but_clear['background'] = "black" but_clear['foreground'] = "cyan" def on_leave5(e): but_clear['background'] = "SystemButtonFace" but_clear['foreground'] = "SystemButtonText" def on_enter6(e): but_delete['background'] = "black" but_delete['foreground'] = "cyan" def on_leave6(e): but_delete['background'] = "SystemButtonFace" but_delete['foreground'] = "SystemButtonText" def on_enter7(e): but_clear_del['background'] = "black" but_clear_del['foreground'] = "cyan" def on_leave7(e): but_clear_del['background'] = "SystemButtonFace" but_clear_del['foreground'] = "SystemButtonText" def clear_name_contact(): names.set("") contacts.set("") sid.set("") def clear_id(): ids.set("") def trees(): contact_trees.delete(*contact_trees.get_children()) def add_number(): if (len(names.get()) != 0): if (len(contacts.get()) != 0): add_contacts(names.get(), contacts.get()) view_number() clear_name_contact() else: tkinter.messagebox.showerror("Error", "Please Enter mobile number") else: tkinter.messagebox.showerror("Error", "Please Enter name") def view_number(): contact_trees.delete(*contact_trees.get_children()) for row in view_contacts(): contact_trees.insert('', END, values=row) def delete_number(): if (len(ids.get()) != 0): delete_contact(ids.get()) view_number() else: tkinter.messagebox.showerror( "Error", "Please Enter number to delete contact") def update_number(): if (len(names.get()) != 0): delete_contact(sid.get()) if (len(names.get()) != 0): add_contacts(names.get(), contacts.get()) clear_name_contact() view_number() #==================Frame===========================# mainframe = Frame(self.root, width=450, height=600, relief="ridge", bd=3) mainframe.place(x=0, y=0) firstframe = Frame(mainframe, width=444, height=220, relief="ridge", bd=3) firstframe.place(x=0, y=0) secondframe = Frame(mainframe, width=444, height=373, relief="ridge", bd=3) secondframe.place(x=0, y=220) #=====================firstframe====================# tabControl = Notebook(firstframe, width=435, height=189) see_contacts = Frame(tabControl, background="grey57") add_edit_contacts = Frame(tabControl, background="grey87") delete_contacts = Frame(tabControl, background="grey77") tabControl.add(see_contacts, text='See Contacts') tabControl.add(add_edit_contacts, text='Add/Edit Contacts') tabControl.add(delete_contacts, text='Delete Contacts') tabControl.place(x=0, y=0) #========================see contacts======================# button_see_contacts = Button(see_contacts, text="See Contacts", width=14, font=('times new roman', 15), cursor="hand2", command=view_number) button_see_contacts.place(x=130, y=30) button_see_contacts.bind("<Enter>", on_enter1) button_see_contacts.bind("<Leave>", on_leave1) button_clear_tree = Button(see_contacts, text="Clear", width=14, font=('times new roman', 15), cursor="hand2", command=trees) button_clear_tree.place(x=130, y=120) button_clear_tree.bind("<Enter>", on_enter2) button_clear_tree.bind("<Leave>", on_leave2) #========================Add/Edit Contact=================# lab_name = Label(add_edit_contacts, text="Enter Name", font=('times new roman', 14), bg="grey87") lab_name.place(x=160, y=5) ent_name = Entry(add_edit_contacts, width=35, font=('times new roman', 13), relief="ridge", bd=4, textvariable=names) ent_name.place(x=55, y=30) ent_sid = Entry(add_edit_contacts, width=3, font=('times new roman', 13), relief="ridge", bd=4, textvariable=sid) ent_sid.place(x=1, y=0) lab_contact_number = Label(add_edit_contacts, text="Enter Contact Number", font=('times new roman', 14), bg="grey87") lab_contact_number.place(x=130, y=75) ent_contact_number = Entry(add_edit_contacts, width=35, font=('times new roman', 13), relief="ridge", bd=4, textvariable=contacts) ent_contact_number.place(x=55, y=100) but_add = Button(add_edit_contacts, text="Add Contacts", width=12, font=('times new roman', 12), cursor="hand2", command=add_number) but_add.place(x=20, y=150) but_add.bind("<Enter>", on_enter3) but_add.bind("<Leave>", on_leave3) but_edit = Button(add_edit_contacts, text="Edit Contacts", width=12, font=('times new roman', 12), cursor="hand2", command=update_number) but_edit.place(x=159, y=150) but_edit.bind("<Enter>", on_enter4) but_edit.bind("<Leave>", on_leave4) but_clear = Button(add_edit_contacts, text="Clear", width=12, font=('times new roman', 12), cursor="hand2", command=clear_name_contact) but_clear.place(x=300, y=150) but_clear.bind("<Enter>", on_enter5) but_clear.bind("<Leave>", on_leave5) #====================Delete Contact==================================# lab_id = Label(delete_contacts, text="ID", font=('times new roman', 14), bg="grey77") lab_id.place(x=200, y=5) ent_id = Entry(delete_contacts, width=35, font=('times new roman', 13), relief="ridge", bd=4, textvariable=ids) ent_id.place(x=55, y=40) but_delete = Button(delete_contacts, text="Delete Contacts", width=12, font=('times new roman', 14), cursor="hand2", command=delete_number) but_delete.place(x=35, y=100) but_delete.bind("<Enter>", on_enter6) but_delete.bind("<Leave>", on_leave6) but_clear_del = Button(delete_contacts, text="Clear", width=14, font=('times new roman', 14), cursor="hand2", command=clear_id) but_clear_del.place(x=250, y=100) but_clear_del.bind("<Enter>", on_enter7) but_clear_del.bind("<Leave>", on_leave7) #===================secondframe======================================# def game(event): crow = contact_trees.focus() contents = contact_trees.item(crow) row = contents['values'] sid.set(row[0]) names.set(row[1]) contacts.set(row[2]) scol = Scrollbar(secondframe, orient="vertical") scol.place(relx=1, rely=0, relheight=1, anchor='ne') contact_trees = ttk.Treeview(secondframe, columns=("ID", "Name", "Contact Number"), height=17, yscrollcommand=scol.set) contact_trees.heading("ID", text="ID") contact_trees.heading("Name", text="Name") contact_trees.heading("Contact Number", text="Contact Number") contact_trees['show'] = "headings" contact_trees.column("ID", width=50, minwidth=10) contact_trees.column("Name", width=170, minwidth=40) contact_trees.column("Contact Number", width=196, minwidth=40) contact_trees.place(x=0, y=0) contact_trees.bind('<ButtonRelease-1>', game)
notebook = Notebook(root) page1 = Frame(notebook, width=650, height=550, bg='white') page2 = Frame(notebook, width=650, height=550, bg='white') page3 = Frame(notebook, width=650, height=550, bg='white') page4 = Frame(notebook, width=650, height=550, bg='white') page5 = Frame(notebook, width=650, height=550, bg='white') notebook.add(page1, text=f'{"Starters": ^33}') notebook.add(page2, text=f'{"Non Veg": ^33}') notebook.add(page3, text=f'{"Veg": ^33}') notebook.add(page4, text=f'{"Desserts": ^33}') notebook.add(page5, text=f'{"Drinks": ^33}') notebook.place(x=130, y=50) def hover(widget, on_entrance, on_exit, entrance_fg, exit_fg): widget.bind("<Enter>", func=lambda e: widget.config( bg=on_entrance, fg=entrance_fg)) widget.bind("<Leave>", func=lambda e: widget.config( bg=on_exit, fg=exit_fg)) def signup(): signup_window = Tk() signup_window.title("SignUp to Continue") signup_window.geometry("600x300") signup_window.resizable(False, False)