Working on projects
This commit is contained in:
		
							parent
							
								
									30844e3bae
								
							
						
					
					
						commit
						04433130e1
					
				| 
						 | 
					@ -7,12 +7,14 @@ from tkinter import messagebox
 | 
				
			||||||
from PIL import ImageTk, Image
 | 
					from PIL import ImageTk, Image
 | 
				
			||||||
import os, os.path
 | 
					import os, os.path
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					WIN_WIDTH = 1200
 | 
				
			||||||
 | 
					WIN_HEIGHT = 1000
 | 
				
			||||||
win = ttk.Window()
 | 
					win = ttk.Window()
 | 
				
			||||||
win.title("Image Viewer")
 | 
					win.title("Image Viewer")
 | 
				
			||||||
ttk.Style("superhero")
 | 
					ttk.Style("superhero")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# size of the window
 | 
					# size of the window
 | 
				
			||||||
win.geometry("1200x1000")
 | 
					win.geometry(f"{WIN_WIDTH}x{WIN_HEIGHT}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
main_frame = ttk.Frame(win)
 | 
					main_frame = ttk.Frame(win)
 | 
				
			||||||
main_frame.pack()
 | 
					main_frame.pack()
 | 
				
			||||||
| 
						 | 
					@ -29,7 +31,7 @@ imgs = []
 | 
				
			||||||
def explor_file():
 | 
					def explor_file():
 | 
				
			||||||
    global file_location
 | 
					    global file_location
 | 
				
			||||||
    no_label.configure(text="")
 | 
					    no_label.configure(text="")
 | 
				
			||||||
    file_location = filedialog.askdirectory(initialdir= '/', title="Selevt Folder")
 | 
					    file_location = filedialog.askdirectory(initialdir= '/', title="Select Folder")
 | 
				
			||||||
    explorer_entery.delete(0, END)
 | 
					    explorer_entery.delete(0, END)
 | 
				
			||||||
    explorer_entery.insert(0, file_location)
 | 
					    explorer_entery.insert(0, file_location)
 | 
				
			||||||
    set_img_list()
 | 
					    set_img_list()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,10 +7,13 @@ pygame.init()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SCREEN_WIDTH = 800
 | 
					SCREEN_WIDTH = 800
 | 
				
			||||||
SCREEN_HEIGTH = 600
 | 
					SCREEN_HEIGTH = 600
 | 
				
			||||||
 | 
					FPS = 60
 | 
				
			||||||
 | 
					STEP_SIZE = 4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGTH))
 | 
					screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGTH))
 | 
				
			||||||
player = pygame.Rect((300,250,50,50))
 | 
					player = pygame.Rect((300,250,50,50))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					clock = pygame.time.Clock()
 | 
				
			||||||
run = True
 | 
					run = True
 | 
				
			||||||
while run:
 | 
					while run:
 | 
				
			||||||
    screen.fill((0, 0, 0))
 | 
					    screen.fill((0, 0, 0))
 | 
				
			||||||
| 
						 | 
					@ -18,18 +21,20 @@ while run:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    key = pygame.key.get_pressed()
 | 
					    key = pygame.key.get_pressed()
 | 
				
			||||||
    if key[pygame.K_a] == True:
 | 
					    if key[pygame.K_a] == True:
 | 
				
			||||||
        player.move_ip(-1, 0)
 | 
					        player.move_ip((-1 * STEP_SIZE), 0)
 | 
				
			||||||
    elif key[pygame.K_d] == True:
 | 
					    elif key[pygame.K_d] == True:
 | 
				
			||||||
        player.move_ip(1, 0)
 | 
					        player.move_ip((1 * STEP_SIZE), 0)
 | 
				
			||||||
    elif key[pygame.K_w] == True:
 | 
					    elif key[pygame.K_w] == True:
 | 
				
			||||||
        player.move_ip(0, -1)
 | 
					        player.move_ip(0, (-1 * STEP_SIZE))
 | 
				
			||||||
    elif key[pygame.K_s] == True:
 | 
					    elif key[pygame.K_s] == True:
 | 
				
			||||||
        player.move_ip(0, 1)
 | 
					        player.move_ip(0, (1 * STEP_SIZE))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for event in pygame.event.get():
 | 
					    for event in pygame.event.get():
 | 
				
			||||||
        if event.type == pygame.QUIT:
 | 
					        if event.type == pygame.QUIT:
 | 
				
			||||||
            run = False
 | 
					            run = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pygame.display.update()
 | 
					    pygame.display.update()
 | 
				
			||||||
 | 
					    clock.tick(FPS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
pygame.quit()
 | 
					pygame.quit()
 | 
				
			||||||
| 
						 | 
					@ -1,10 +1,9 @@
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
 | 
					os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
 | 
				
			||||||
import pygame
 | 
					import pygame
 | 
				
			||||||
import random
 | 
					import random
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
WIDTH = 480
 | 
					WIDTH = 480
 | 
				
			||||||
HEIGHT = 600
 | 
					HEIGHT = 600
 | 
				
			||||||
WINDOW_SIZE = (WIDTH, HEIGHT)
 | 
					WINDOW_SIZE = (WIDTH, HEIGHT)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user