Advertisement
Guest User

Untitled

a guest
May 27th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.02 KB | None | 0 0
  1. import pygame
  2.  
  3. import tkinter
  4. import tkinter as tk
  5. from tkinter import *
  6. import os
  7.  
  8. # All the sick window stuff
  9. root = Tk()
  10. embed = tk.Frame(root, width = 1366, height = 768) #creates embed frame for pygame window
  11. embed.grid(columnspan = (600), rowspan = 500) # Adds grid
  12. embed.pack(side = LEFT) #packs window to the left
  13.  
  14. # Tell the user what they are actually using.
  15. root.title("The Joker Engine (Version Undecided) - By Harrison Court")
  16.  
  17. # Button Position
  18. buttonPos = tk.Frame(root, width = 75, height = 500)
  19. buttonPos.pack(side = LEFT)
  20.  
  21. # Do stuff beyond my knowledge
  22. os.environ['SDL_WINDOWID'] = str(embed.winfo_id())
  23. os.environ['SDL_VIDEODRIVER'] = 'windib'
  24.  
  25. # Set the display of the viewport
  26. screen = pygame.display.set_mode((1280, 720))
  27.  
  28. # Set the display colour and be on our merry way.
  29. screen.fill(pygame.Color(255, 255, 255)) # Make the colour white
  30. pygame.display.init()
  31. pygame.display.update()
  32.  
  33. # Button Class
  34. class Window(Frame):
  35.  
  36.     def __init__(self, master = None):
  37.         Frame.__init__(self, master)
  38.         self.master = master
  39.         self.init_window()
  40.  
  41.     def init_window(self):
  42.  
  43.         self.pack(fill=BOTH, expand=1)
  44.  
  45.         # Create the Menubar
  46.         menu = Menu(self.master)
  47.         self.master.config(menu=menu)
  48.  
  49.         # File Cascade
  50.         file = Menu(menu)
  51.         file.add_command(label="New Project")
  52.         file.add_command(label="Open Project")
  53.         file.add_command(label="Save")
  54.         file.add_command(label="Save As...")
  55.         file.add_command(label="Quit",)
  56.         menu.add_cascade(label="File", menu=file)
  57.  
  58.         # Edit Cascade
  59.         edit = Menu(menu)
  60.         edit.add_command(label="Undo")
  61.         menu.add_cascade(label="Edit", menu=edit)
  62.  
  63.         gameObject = Menu(menu)
  64.         gameObject.add_command(label="Draw Circle", command=drawCircle())
  65.         gameObject.add_command(label="Draw Rect.", command=rectCreationWindow)
  66.         gameObject.add_command(label="Add Sprite")
  67.         menu.add_cascade(label="Game Object", menu=gameObject)
  68.  
  69.  
  70. class drawing:
  71.  
  72.  
  73.     def drawCircle(self):
  74.         pygame.draw.circle(screen, (0,0,0), (250,250), 125)
  75.         pygame.display.update()
  76.  
  77.     def drawRect(self):
  78.         pygame.draw.rect(screen, (0,0,0), (250,250), self.width, self.length)
  79.         pygame.display.update()
  80.  
  81.     # The object creation window; Used to make more shaps
  82.     def rectCreationWindow(self):
  83.  
  84.         # Create the window.
  85.         objWindow = Tk()
  86.         objWindow.wm_title("Create a Game Object")
  87.         objWindow.geometry("300x300")
  88.  
  89.         # Width
  90.         self.width = Entry(objWindow)
  91.         self.width.pack()
  92.         self.width.focus_set()
  93.  
  94.         # Length
  95.         self.length = Entry(objWindow)
  96.         self.length.pack()
  97.         self.length.focus_set()
  98.  
  99.         createObjButton = tk.Button(objWindow, text ='Create Object')
  100.         pygame.display.update()
  101.         createObjButton.pack()
  102.  
  103.         objWindow.mainloop()
  104.  
  105. app = Window(root)
  106. root.mainloop()
  107.  
  108. #root.update()
  109. #pygame.display.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement