Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- import tkinter
- import tkinter as tk
- from tkinter import *
- import os
- # All the sick window stuff
- root = Tk()
- embed = tk.Frame(root, width = 1366, height = 768) #creates embed frame for pygame window
- embed.grid(columnspan = (600), rowspan = 500) # Adds grid
- embed.pack(side = LEFT) #packs window to the left
- # Tell the user what they are actually using.
- root.title("The Joker Engine (Version Undecided) - By Harrison Court")
- # Button Position
- buttonPos = tk.Frame(root, width = 75, height = 500)
- buttonPos.pack(side = LEFT)
- # Do stuff beyond my knowledge
- os.environ['SDL_WINDOWID'] = str(embed.winfo_id())
- os.environ['SDL_VIDEODRIVER'] = 'windib'
- # Set the display of the viewport
- screen = pygame.display.set_mode((1280, 720))
- # Set the display colour and be on our merry way.
- screen.fill(pygame.Color(255, 255, 255)) # Make the colour white
- pygame.display.init()
- pygame.display.update()
- # Button Class
- class Window(Frame):
- def __init__(self, master = None):
- Frame.__init__(self, master)
- self.master = master
- self.init_window()
- def init_window(self):
- self.pack(fill=BOTH, expand=1)
- # Create the Menubar
- menu = Menu(self.master)
- self.master.config(menu=menu)
- # File Cascade
- file = Menu(menu)
- file.add_command(label="New Project")
- file.add_command(label="Open Project")
- file.add_command(label="Save")
- file.add_command(label="Save As...")
- file.add_command(label="Quit",)
- menu.add_cascade(label="File", menu=file)
- # Edit Cascade
- edit = Menu(menu)
- edit.add_command(label="Undo")
- menu.add_cascade(label="Edit", menu=edit)
- gameObject = Menu(menu)
- gameObject.add_command(label="Draw Circle", command=drawCircle())
- gameObject.add_command(label="Draw Rect.", command=rectCreationWindow)
- gameObject.add_command(label="Add Sprite")
- menu.add_cascade(label="Game Object", menu=gameObject)
- class drawing:
- def drawCircle(self):
- pygame.draw.circle(screen, (0,0,0), (250,250), 125)
- pygame.display.update()
- def drawRect(self):
- pygame.draw.rect(screen, (0,0,0), (250,250), self.width, self.length)
- pygame.display.update()
- # The object creation window; Used to make more shaps
- def rectCreationWindow(self):
- # Create the window.
- objWindow = Tk()
- objWindow.wm_title("Create a Game Object")
- objWindow.geometry("300x300")
- # Width
- self.width = Entry(objWindow)
- self.width.pack()
- self.width.focus_set()
- # Length
- self.length = Entry(objWindow)
- self.length.pack()
- self.length.focus_set()
- createObjButton = tk.Button(objWindow, text ='Create Object')
- pygame.display.update()
- createObjButton.pack()
- objWindow.mainloop()
- app = Window(root)
- root.mainloop()
- #root.update()
- #pygame.display.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement