def parser_gui(username, password): # Working Frame main_frame2 = Frame(root) main_frame2.place(relwidth=1, relheight=1) # Background img = PhotoImage( Image.open(os.path.join(os.getcwd(), r'img\after_login_back.png'))) background = Label(main_frame2, image=img) background.place(relwidth=1, relheight=1) background.image = img # Button img grades_button_img = PhotoImage( Image.open(os.path.join(os.getcwd(), r'img\Grades_button.png'))) gpa_button_img = PhotoImage( Image.open(os.path.join(os.getcwd(), r'img\GPA_button.png'))) done_button_img = PhotoImage( Image.open(os.path.join(os.getcwd(), r'img\Done.png'))) # Buttons grades_button = Button(main_frame2, image=grades_button_img, bg='#4a6eb5', bd=0, command=lambda: grade_parser(username, password)) grades_button.place(relx=0.15, rely=0.43) grades_button.image = grades_button_img gpa_button = Button(main_frame2, image=gpa_button_img, bg='#4a6eb5', bd=0, command=gpa_parser) gpa_button.place(relx=0.15, rely=0.53) gpa_button.image = gpa_button_img done_button = Button(main_frame2, image=done_button_img, bg='#4a6eb5', bd=0, command=done) done_button.place(relx=0.18, rely=0.68) done_button.image = done_button_img # Screen for output # noinspection PyGlobalUndefined global textbox textbox = Text(main_frame2, font=('Arial', 9, 'bold'), fg='#1a1a1a', bg='#f2f2f2') textbox.insert( INSERT, '\n When you are done with the program\n please press done before closing.' ) textbox.place(relx=0.48, rely=0.43, relwidth=0.4, relheight=0.35)
def cachepics(): for summoner in summoners: for card in summoner.deck: cardcaches[card] = {} cardcaches[card]['cardphoto'] = PhotoImage(Image.open(card.cardpicpath).resize((368, 240), Image.ANTIALIAS)) if 'picpath' in card.__dict__: pic = Image.open(card.picpath) if summoner.playernum is 1 or summoner.playernum is 2: #flip it if on right side of board pic = pic.transpose(FLIP_LEFT_RIGHT) cardcaches[card]['photo'] = PhotoImage(pic) else: #use the card pic as board pic if no board pic given cardcaches[card]['photo'] = PhotoImage(Image.open(card.cardpicpath).resize((100, 67), Image.ANTIALIAS)) summoner.faction.logophoto = PhotoImage(Image.open(summoner.faction.path + r'\symbol-lrg.png').resize((15, 15)))
def makeToolBar(self, size=(40, 40)): from PIL.ImageTk import PhotoImage, Image # if jpegs or make new thumbs # importamos PIL para manejar formatos de imagen no soportados por Tkinter => # => instalarla desde synaptic (PIL 3) # simply use special PhotoImage and BitmapImage objects imported from the PIL ImageTk # module to open files in other graphic formats. toolbar = Frame(self, cursor='hand2', relief=SUNKEN, bd=2) toolbar.pack(side=BOTTOM, fill=X) # simply pack buttons (and other kinds of widgets) into a frame, # pack the frame on the bottom of the window, and set it to expand horizontally only. # but make sure to pack toolbars (and frame-based menu bars) early so that other widgets # in the middle of the display are clipped first when the window shrinks photos = 'ora-lp4e-big.jpg', 'PythonPowered.gif', 'python_conf_ora.gif' self.toolPhotoObjs = [] # creamos tres botones con sus correspondientes imágenes for file in photos: imgobj = Image.open(file) # make new thumb imgobj.thumbnail(size, Image.ANTIALIAS) # best downsize filter img = PhotoImage(imgobj) btn = Button(toolbar, image=img, command=self.greeting) btn.config(relief=RAISED, bd=2) btn.config(width=size[0], height=size[1]) btn.pack(side=LEFT) self.toolPhotoObjs.append((img, imgobj)) # keep a reference Button(toolbar, text='Quit', command=self.quit).pack(side=RIGHT, fill=Y)
def login_gui(): # Working Frame # noinspection PyGlobalUndefined global main_frame main_frame = ttk.Frame(root) main_frame.place(relwidth=1, relheight=1) # Background img = PhotoImage(Image.open(os.path.join(os.getcwd(), r'img\back.png'))) background = Label(main_frame, image=img) background.place(relwidth=1, relheight=1) background.image = img # text fields for getting data username_entry = ttk.Entry(main_frame) username_entry.place(relx=0.4, rely=0.4899, relwidth=0.4, relheight=0.045) password_entry = ttk.Entry(main_frame, show='*') password_entry.place(relx=0.4, rely=0.5799, relwidth=0.4, relheight=0.045) # save password checkbox # noinspection PyGlobalUndefined global checkbox checkbox = ttk.Checkbutton(main_frame, text='Save password?') checkbox.state(['!alternate']) checkbox.place(relx=0.45, rely=0.6799, relheight=0.049) # button to login login_button = Button( main_frame, text='login', command=lambda: login(username_entry, password_entry)) login_button.place(relx=0.65, rely=0.6799, relwidth=0.2, relheight=0.05)
def makeToolbarPIL(self): """ на основе PIL изменяет размеры изображений для кнопок на панели инструментов с помощью PIL """ from PIL.ImageTk import PhotoImage, Image # для jpg и новых миниатюр imgdir = r'../PIL/images/' size = (50, 50) toolbar = Frame(self, cursor='hand2', relief=SUNKEN, bd=2) toolbar.pack(side=BOTTOM, fill=X) photos = ('sosnpoln.gif', 'урицк.gif', 'южно-приморский.gif') self.toolPhotoObj = [] for file in photos: imgobj = Image.open(imgdir + file) imgobj.thumbnail(size, Image.ANTIALIAS) img = PhotoImage(imgobj) btn = Button(toolbar, image=img, command=self.greeting) btn.config(relief=RAISED, bd=2) btn.config(width=size[0], height=size[1]) btn.pack(side=LEFT) self.toolPhotoObj.append((img, imgobj)) Button(toolbar, text='Quit', command=self.quit).pack(side=RIGHT, fill=Y)
def setImage(self, imageName): size = self.winfo_width() * 9 / 10 image = Image.open(imageName) image = image.resize((size, size)) self.photo = PhotoImage(image) self.label.config(text=imageName) self.view.config(image=self.photo)
def setImage(self, imageName): size = self.winfo_width()*9/10 image = Image.open(imageName) image = image.resize((size,size)) self.photo = PhotoImage(image) self.label.config(text=imageName) self.view.config(image = self.photo)
def make_canvas(self): """ Criação do canvas para edição da máscara de correção """ h = Scrollbar(self.root, orient=HORIZONTAL) v = Scrollbar(self.root, orient=VERTICAL) self.canvas = Canvas(self.root, scrollregion=(0, 0, 1000, 1000), yscrollcommand=v.set, xscrollcommand=h.set) h['command'] = self.canvas.xview v['command'] = self.canvas.yview self.canvas.grid(column=0, row=0, sticky=(N,W,E,S)) h.grid(column=0, row=1, sticky=(W,E)) v.grid(column=1, row=0, sticky=(N,S)) self.root.grid_columnconfigure(0, weight=1) self.root.grid_rowconfigure(0, weight=1) if self.image: imgtk = PhotoImage(image=Image.open(self.image)) # not file=imgpath imgwide = imgtk.width() # size in pixels imghigh = imgtk.height() # same as imgpil.size fullsize = (0, 0, imgwide, imghigh) # scrollable self.canvas.delete('all') # clear prior photo self.canvas.config(height=imgwide, width=imghigh) # viewable window size self.canvas.config(scrollregion=fullsize) # scrollable area size self.imageid=self.canvas.create_image(0, 0, image=imgtk, anchor=NW) self.images.append(imgtk) self.canvas.bind("<Button-1>", self.xy) self.canvas.bind("<B1-Motion>", self.add_rectangle) self.canvas.bind("<B1-ButtonRelease>", self.done_stroke) self.canvas.bind_all('<Button-2>', self.select) self.canvas.bind_all('<B2-Motion>', self.on_drag) self.canvas.bind_all("<B2-ButtonRelease>", self.update_item) self.canvas.bind('<Button-3>', self.config_item) self.canvas.bind_all('<Delete>',self.delete_item) self.canvas.focus()
def main(): window = tk.Tk() puzzle = logic.createPuzzle(5, 5) logic.scramblePuzzle(puzzle) renderer = createRenderer(window, puzzle, Image.open('C:/Users/Jonatan/Pictures/2013-10-27/IMG_0017.JPG')) bindEvents(renderer) window.mainloop()
def main(): ''' ''' win = tk.Tk() win.geometry('%dx%d' % (1920//2, 1080//2)) Image.open('apple.png') painter = daVinci((1920//2, 1080//2)) painter.addSprite((20, 45, 66, 93), 'rectangle', fill='blue', animator=lambda shape, dt: shape.canvas.move(shape.id, int(50*dt),int(50*dt))) painter.addSprite((20, 45, 66, 93), 'oval', fill='yellow', animator=lambda shape, dt: shape.canvas.move(shape.id, int(82*dt),int(30*dt))) painter.addSprite(((20, 45), (66, 93), (2, 70)), 'polygon', fill='orange', animator=lambda shape, dt: shape.canvas.move(shape.id, int(10*dt),int(50*dt))) painter.addSprite((35, 200), 'image', image='apple.png', animator=moveApple()) painter.begin(win) # win.mainloop()
def setImage(self): imgdata = self.cam.image() self.sg.debug("Tk picture import") timeit = self.sg.timeit() image = Image.frombuffer( "RGBA", (self.cam.draw2d.width, self.cam.draw2d.height), imgdata, decoder_name="raw").convert("RGB") self.img = PhotoImage(image) self.sg.debug("Tk picture import complete.", timeit=timeit)
def slide(d): global image_list,text_list,move # if not (0 <= move + d < len(image_list)): # tkMessageBox.showinfo('End', 'No more image.') # return move+=d image = Image.open(image_list[move]) photo = PhotoImage(image) w['text'] = text_list[move] w['image']= photo w.photo = photo
def showImage(self): self.framesShown += 1 imgdata = self.cam.image() self.sg.debug("Tk picture import") timeit = self.sg.timeit() image = Image.frombuffer("RGBA", (self.cam.draw2d.width,self.cam.draw2d.height), imgdata, decoder_name="raw").convert("RGB") self.img = PhotoImage(image) self.sg.debug("Tk picture import complete.", timeit=timeit) timeit = self.sg.timeit() self.canvas.create_image(0, 0, anchor=NW, image=self.img) self.updateWidgets() self.sg.debug("update Tk Tasks") self.sg.debug("Tk Tasks updated, picture outlined", timeit=timeit)
def draw_env(self, event=None): # delete the old contents self.canvas.delete("all") if "map_image_file" in dir(self.rli.env) and self.rli.env.map_image_file: from PIL.ImageTk import PhotoImage, Image self.map = Image.open(self.rli.env.map_image_file) self.photo = PhotoImage(self.map) self.resize_map() self.canvas.create_image(0, 0, anchor="nw", image=self.photo) else: self.rli.env.map_image_file = None for r, row in enumerate(self.rli.env.grid): for c, cell in enumerate(row): x1, y1, x2, y2 = self.cell_coords(r, c) if cell == WALL: if not self.rli.env.map_image_file: self.canvas.create_rectangle( x1, y1, x2, y2, fill="black", outline="black", tags=["wall", "all"] ) elif (r, c) == self.rli.env.start_pos: self.start = self.canvas.create_oval( x1, y1, x2, y2, fill="green", outline="green", tags=["start", "all"] ) elif (r, c) == self.rli.env.goal_pos: self.goal = self.canvas.create_oval( x1, y1, x2, y2, fill="red", outline="red", tags=["goal", "all"] ) elif cell == FREE: continue else: print "##WARNING##: Unknown cell type", cell self.agent_pos = self.rli.env.curr_pos x1, y1, x2, y2 = self.cell_coords(*self.agent_pos) self.agent_last = self.canvas.create_oval( x1, y1, x2, y2, fill="#EEEEff", outline="#DDDDff", tags=["agent", "all"] ) self.agent_curr = self.canvas.create_oval( x1, y1, x2, y2, fill="blue", outline="blue", tags=["agent", "all"] ) if "crumbs" in dir(self.rli.env) and self.rli.env.crumbs: if hasattr(self, "crumb_lists"): self.clear_crumbs() else: self.crumb_lists = [[]]
def makeToolBar(self, size=(40, 40)): imgdir = r'../Images/' toolbar = Frame(self, cursor='hand2', relief=SUNKEN, bd=2) toolbar.pack(side=BOTTOM, fill=X) photos = 'small2.png', 'small3.png', 'people.png' self.toolPhotoObjs = [] for file in photos: imgobj = Image.open(imgdir + file) # make new thumb imgobj.thumbnail(size, Image.ANTIALIAS) # best downsize filter img = PhotoImage(imgobj) btn = Button(toolbar, image=img, command=self.greeting) btn.config(relief=RAISED, bd=2) btn.config(width=size[0], height=size[1]) btn.pack(side=LEFT) self.toolPhotoObjs.append((img, imgobj)) Button(toolbar, text='Quit', command=self.quit).pack(side=RIGHT, fill=Y)
def make_card_buttons(self): x2 = 50 y2 = 40 img_dir = self.photo_path for pic in self.zener_pics: img_obj = Image.open(img_dir + pic) image = PhotoImage(img_obj) self.zener_buttons.append( Button(self.canvas, image=image, width=120, height=180, bg='skyblue', command=partial(self.check_guess, pic))) self.zener_buttons[-1].place(x=x2, y=y2) x2 += 130 self.image_ref.append(image)
def makeToolBar(self, size=(40, 40)): from PIL.ImageTk import PhotoImage, Image # if jpegs or make new thumbs imgdir = 'images/' toolbar = Frame(self, cursor='hand2', relief=SUNKEN, bd=2) toolbar.pack(side=BOTTOM, fill=X) photos = 'ora-lp4e-big.jpg', 'PythonPoweredAnim.gif', 'python_conf_ora.gif' self.toolPhotoObjs = [] for file in photos: imgobj = Image.open(imgdir + file) # make new thumb imgobj.thumbnail(size, Image.ANTIALIAS) # best downsize filter img = PhotoImage(imgobj) btn = Button(toolbar, image=img, command=self.greeting) btn.config(relief=RAISED, bd=2) btn.config(width=size[0], height=size[1]) btn.pack(side=LEFT) self.toolPhotoObjs.append((img, imgobj)) # keep a reference Button(toolbar, text='Quit', command=self.quit).pack(side=RIGHT, fill=Y)
def makeTollBar(self, size=(40, 40)): from PIL.ImageTk import PhotoImage, Image imgdir = '../images/' toolbar = Frame(self, cursor='hand2', relief=SUNKEN, bd=2) toolbar.pack(side=BOTTOM, fill=X) photos = 'forests1.jpg', 'forests2.jpg', 'forests3.jpg' self.toolPhotoObjs = [] for file in photos: imgobj = Image.open(imgdir + file) imgobj.thumbnail(size, Image.ANTIALIAS) img = PhotoImage(imgobj) btn = Button(toolbar, image=img, command=self.greeting) btn.config(relief=RAISED, bd=2) btn.config(width=size[0], height=size[1]) btn.pack(side=LEFT) self.toolPhotoObjs.append((img, imgobj)) Button(toolbar, text='Quit', command=self.quit).pack(side=RIGHT, fill=Y)
def makeToolBar(self, size=(40, 40)): from PIL.ImageTk import PhotoImage, Image # if jpegs or make new thumbs imgdir = r'../PIL/images/' toolbar = Frame(self, cursor='hand2', relief=SUNKEN, bd=2) toolbar.pack(side=BOTTOM, fill=X) photos = 'ora-lp4e-big.jpg', 'PythonPoweredAnim.gif', 'python_conf_ora.gif' self.toolPhotoObjs = [] for file in photos: imgobj = Image.open(imgdir + file) # make new thumb imgobj.thumbnail(size, Image.ANTIALIAS) # best downsize filter img = PhotoImage(imgobj) btn = Button(toolbar, image=img, command=self.greeting) btn.config(relief=RAISED, bd=2) btn.config(width=size[0], height=size[1]) btn.pack(side=LEFT) self.toolPhotoObjs.append((img, imgobj)) # keep a reference Button(toolbar, text='Quit', command=self.quit).pack(side=RIGHT, fill=Y)
def _line_clicked(self): firstButton = self.image_viewer._button_clicked if firstButton != None: indexFrom = firstButton[1] indexTo = self.index Buttons = self.image_viewer._buttons_array Images = self.image_viewer._images_array buff = Images[indexFrom] if indexTo > indexFrom and indexTo - indexFrom > 1: for add in range(indexTo - indexFrom - 1): Images[indexFrom + add] = Images[indexFrom + add + 1] Buttons[indexFrom + add].config(image=Images[indexFrom + add]["thumb"]) Images[indexTo - 1] = buff Buttons[indexTo - 1].config(image=Images[indexTo - 1]["thumb"]) elif indexTo < indexFrom and indexFrom - indexTo >= 1: for add in range(indexFrom - indexTo): Images[indexFrom - add] = Images[indexFrom - add - 1] Buttons[indexFrom - add].config(image=Images[indexFrom - add]["thumb"]) Images[indexTo] = buff Buttons[indexTo].config(image=Images[indexTo]["thumb"]) Buttons[indexFrom].config(relief=tkinter.RAISED) self.image_viewer._delete_button.config(state=tkinter.DISABLED) self.image_viewer._button_clicked = None else: filename = filedialog.askopenfilename( initialdir="/", title="Выберите файл", filetypes=(("jpeg files", "*.jpg"), ("all files", "*.*"))) if filename != "": imgObj = Image.open(filename) imageCopy = imgObj.copy() imageCopy.thumbnail(self.image_viewer._thumb_size, Image.ANTIALIAS) thumbnail = PhotoImage(imageCopy) imgDict = {"img": imgObj, "thumb": thumbnail, "start_index": 0} self.image_viewer._images_array.insert(self.index, imgDict) self.image_viewer._draw_images() self.image_viewer._check_changes()
def makeToolBar(self, size=(40, 40)): # 使用图片按钮 from PIL.ImageTk import PhotoImage, Image imgdir = r'images/' toolbar = Frame(self, cursor='hand2', relief=SUNKEN, bd=2) toolbar.pack(side=BOTTOM, fill=X) Button(toolbar, text='Hello', command=self.greeting).pack(side=LEFT) photos = ('ora-lp4e-big.jpg', 'PythonPoweredAnim.gif', 'python_conf_ora.gif') self.toolPhotosObjs = [] for file in photos: imgobj = Image.open(imgdir + file) imgobj.thumbnail(size, Image.ANTIALIAS) img = PhotoImage(imgobj) btn = Button(toolbar, image=img, command=self.greeting) btn.config(relief=RAISED, bd=2) btn.config(width=size[0], height=size[1]) btn.pack(side=LEFT) self.toolPhotosObjs.append((img, imgobj)) Button(toolbar, text='Quit', command=self.quit).pack(side=RIGHT)
def __init__(self, canvas, vertices, shape, image=None, animator=None, **options): ''' ''' # TODO: Make sure wrapper is synched with canvas object (gettattr?) # TODO: Normalize position arg # Normalize arguments if image is not None: self.image = PhotoImage(Image.open(image)) if isinstance(image, str) else image options['image'] = self.image shape = 'image' # Initialize properties, create sprite self.canvas = canvas self.shape = shape self.id = self.shapeMethod(shape)(vertices, **options) self.visible = canvas.itemcget(self.id, 'state') == tk.NORMAL self.pos = self.position() self.animator = choose(animator, lambda sprite, dt: None) # TODO: Make bound method somehow (?)
def createWindow(size): ''' ''' # Create and configure window window = tk.Tk() window.title('Newtonian') window.size = size.real, size.imag window.geometry('%dx%d' % window.size) # Set icon window.icon = PhotoImage(Image.open('apple.png')) window.call('wm', 'iconphoto', window._w, window.icon) # Settings window.PAUSE = False # Create canvas canvas = tk.Canvas(width=width, height=height, bd=0) canvas.pack() return window, canvas
def _load_images(self): try: with FTP(host = FTP_ACCOUNT["host"], user = FTP_ACCOUNT["user"], passwd = FTP_ACCOUNT["passwd"]) as self.connection: self.connection.cwd("domains") self.connection.cwd("viva-comfort.com") self.connection.cwd("gallery") if self._mode == "test": img_array = os.listdir("images") img_array = sorted(img_array, key=lambda img: int(img.split(".")[0])) images_number = len(img_array) for index, imgName in enumerate(img_array, 1): imgObj = Image.open(os.path.join("images",imgName)) imageCopy = imgObj.copy() imageCopy.thumbnail( self.thumbnail_size, Image.ANTIALIAS ) thumbnail = PhotoImage(imageCopy) self.loading.set_progress(round(index / images_number * 100, 2)) self.loading.set_info("Загружено %s фото из %s" % (index, images_number)) imgName = {"img":imgObj, "thumb":thumbnail, "start_index":index} self.img_array.append(imgName) elif self._mode == "work": img_array = [image[0] for image in self.connection.mlsd() if image[0] != "." and image[0] != ".."] img_array = sorted(img_array, key=lambda img: int(img.split(".")[0])) self.total = 0 self.downloaded = 0 self.connection.sendcmd("TYPE i") # Switch to Binary mode #calculcating total byte size of images for img in img_array: self.total += self.connection.size(img) self.connection.sendcmd("TYPE A") # Switch back to ASCII mode images_number = len(img_array) #images loading for index, imgName in enumerate(img_array, 1): buff = BytesIO() #progressbar function that recive loaded data and changes progressbar def wrt(data): self.downloaded += buff.write(data) self.loading.set_progress(round(self.downloaded / self.total * 100, 2)) self.connection.retrbinary("RETR "+imgName, wrt, 8*1024) self.loading.set_info("Загружено %s фото из %s" % (index, images_number)) imgObj = Image.open(buff) imageCopy = imgObj.copy() imageCopy.thumbnail( self.thumbnail_size, Image.ANTIALIAS ) thumbnail = PhotoImage(imageCopy) imgName = {"img":imgObj, "thumb":thumbnail, "start_index":index} self.img_array.append(imgName) self.connection.close() self.loading.set_info("Загрузка завершена !") self.loading.after(500,self.loading.stop_aimation) self.show_window() except IOError : del self.img_array self.img_array = [] messagebox.showinfo("Сообщение об ошибке", "ошибка подключения, пытаемся снова.") self._load_images()
def draw_env(self, event=None): # delete the old contents self.canvas.delete('all') if 'map_image_file' in dir( self.rli.env) and self.rli.env.map_image_file: from PIL.ImageTk import PhotoImage, Image self.map = Image.open(self.rli.env.map_image_file) self.photo = PhotoImage(self.map) self.resize_map() self.canvas.create_image(0, 0, anchor='nw', image=self.photo) else: self.rli.env.map_image_file = None for r, row in enumerate(self.rli.env.grid): for c, cell in enumerate(row): x1, y1, x2, y2 = self.cell_coords(r, c) if cell == WALL: if not self.rli.env.map_image_file: self.canvas.create_rectangle(x1, y1, x2, y2, fill='black', outline='black', tags=['wall', 'all']) elif (r, c) == self.rli.env.start_pos: self.start = self.canvas.create_oval( x1, y1, x2, y2, fill='green', outline='green', tags=['start', 'all']) elif (r, c) == self.rli.env.goal_pos: self.goal = self.canvas.create_oval( x1, y1, x2, y2, fill='red', outline='red', tags=['goal', 'all']) elif cell == FREE: continue else: print "##WARNING##: Unknown cell type", cell self.agent_pos = self.rli.env.curr_pos x1, y1, x2, y2 = self.cell_coords(*self.agent_pos) self.agent_last = self.canvas.create_oval(x1, y1, x2, y2, fill='#EEEEff', outline='#DDDDff', tags=['agent', 'all']) self.agent_curr = self.canvas.create_oval(x1, y1, x2, y2, fill='blue', outline='blue', tags=['agent', 'all']) if 'crumbs' in dir(self.rli.env) and self.rli.env.crumbs: if hasattr(self, 'crumb_lists'): self.clear_crumbs() else: self.crumb_lists = [[]]
def createEmpty(width, height, colour='white'): return PhotoImage(Image.new('RGB', (width, height), colour)) # Create white tile
def __init__(self, parent=None): self.parent = parent Frame.__init__(self, self.parent) self.pack(expand='yes', fill='both') self.canvas = Canvas(self) self.canvas.config(width=1000, height=880, bg='skyblue') self.canvas.pack(expand='yes', fill='both') self.btn = Button(self.canvas, text='start', command=self.get_entry) self.btn.place(x=800, y=60) self.bind_all('<Key>', self.key) self.zener_deck_base = [ 'Yellow Circle', 'Red Plus', 'Blue Waves', 'Black Square', 'Green Star' ] self.zener_pics = [ 'Yellow_Circle.png', 'Red_Plus.png', 'Blue_Waves.png', 'Black_Square.png', 'Green_Star.png' ] self.photo_path = 'zener/' self.image_ref = [] self.image_ref2 = [] self.zener_buttons = [] self.my_font = ('arial', 26, 'bold') self.circle_count = IntVar(value=0) self.circle_lbl = Label(self.canvas, textvariable=self.circle_count, font=self.my_font, bg='skyblue') self.circle_lbl.place(x=100, y=240) self.plus_count = IntVar(value=0) self.plus_lbl = Label(self.canvas, textvariable=self.plus_count, font=self.my_font, bg='skyblue') self.plus_lbl.place(x=230, y=240) self.wave_count = IntVar(value=0) self.wave_lbl = Label(self.canvas, textvariable=self.wave_count, font=self.my_font, bg='skyblue') self.wave_lbl.place(x=370, y=240) self.square_count = IntVar(value=0) self.square_lbl = Label(self.canvas, textvariable=self.square_count, font=self.my_font, bg='skyblue') self.square_lbl.place(x=500, y=240) self.star_count = IntVar(value=0) self.star_lbl = Label(self.canvas, textvariable=self.star_count, font=self.my_font, bg='skyblue') self.star_lbl.place(x=630, y=240) img = Image.open('zener/blank_card.png') image_ = PhotoImage(img) self.guess_card = Label(self.canvas, image=image_, width=360, height=600, bg='skyblue') self.guess_card.place(x=300, y=280) self.image_ref2.append(image_) self.card_count = IntVar(value=25) self.cards_left = Label(self.canvas, textvariable=self.card_count, font=self.my_font, bg='skyblue') self.cards_left.place(x=140, y=600) self.deck = self.zener_deck_base * 5 self.current_card = 0 self.win = 0 self.loss = 0 self.outcome_answer = {} self.g_count = 0
import quotes import time from datetime import date from PIL.ImageTk import PhotoImage, Image weather_obj = weather.Weather() news_obj = news.News() months = ["January", "February", "March", "April", "May", "June", "July",\ "August", "September", "October", "November", "December"] weekdays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday",\ "Saturday", "Sunday"] large_icons = {"cloudy": Image.open("bigcloudy.png"), "clear-night": Image.open("bignight.png"), "foggy": Image.open('bigcloudy.png')\ , "partly-cloudy-night": Image.open("bignightcloudy.png"), "partly-cloudy-day": Image.open("bigpartlycloudy.png"),\ "rain": Image.open("bigrainy.png"), "clear-day": Image.open("bigsun.png"), "thunderstorm": Image.open("bigstorm.png")} small_icons = {"cloudy": Image.open("cloudy.png"), "clear-night": Image.open("night.png"), "foggy": Image.open('cloudy.png')\ , "partly-cloudy-night": Image.open("nightcloudy.png"), "partly-cloudy-day": Image.open("partlycloudy.png"),\ "rain": Image.open("rain.png"), "clear-day": Image.open("sun.png"), "thunderstorm": Image.open("storm.png")} year, month, day = str(date.today()).split('-') week_index = date(int(year), int(month), int(day)).weekday() def date_as_str(): return f'{weekdays[week_index]}, {months[int(month)]} {int(day)}, {year}' def time_as_str(): time_str = time.strftime("%I:%M %p", time.localtime())