commit
7d3f7c16ab
18 changed files with 1133 additions and 0 deletions
11
.idea/JDE.iml
generated
Normal file
11
.idea/JDE.iml
generated
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="TestRunnerService">
|
||||
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
|
||||
</component>
|
||||
</module>
|
45
.idea/misc.xml
generated
Normal file
45
.idea/misc.xml
generated
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectInspectionProfilesVisibleTreeState">
|
||||
<entry key="Project Default">
|
||||
<profile-state>
|
||||
<expanded-state>
|
||||
<State>
|
||||
<id />
|
||||
</State>
|
||||
</expanded-state>
|
||||
<selected-state>
|
||||
<State>
|
||||
<id>Python</id>
|
||||
</State>
|
||||
</selected-state>
|
||||
</profile-state>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
<OptionsSetting value="true" id="Checkout" />
|
||||
<OptionsSetting value="true" id="Update" />
|
||||
<OptionsSetting value="true" id="Status" />
|
||||
<OptionsSetting value="true" id="Edit" />
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.5.1+ (/usr/bin/python3.5)" project-jdk-type="Python SDK" />
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ScopeChooserConfigurable.UI">
|
||||
<settings>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/JDE.iml" filepath="$PROJECT_DIR$/.idea/JDE.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
BIN
JDE/Images/background.png
Normal file
BIN
JDE/Images/background.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 MiB |
BIN
JDE/Images/file.png
Normal file
BIN
JDE/Images/file.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
JDE/Images/start.png
Normal file
BIN
JDE/Images/start.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
291
JDE/Interfaces/desktop.py
Normal file
291
JDE/Interfaces/desktop.py
Normal file
|
@ -0,0 +1,291 @@
|
|||
import logging
|
||||
import os
|
||||
import time
|
||||
import webbrowser
|
||||
from tkinter import *
|
||||
|
||||
from JDE.Interfaces import start
|
||||
from Programs import jpad
|
||||
|
||||
desktopLog = logging.getLogger("desktop.py")
|
||||
|
||||
desktopLog.debug("Atempting to read settings file")
|
||||
try:
|
||||
config = {}
|
||||
exec(open("JDE/Settings/settings.conf").read(), config)
|
||||
desktopLog.debug("System settings Detected!")
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
||||
|
||||
|
||||
class desktop:
|
||||
def box(self, event):
|
||||
desktopLog.debug("Running box")
|
||||
try:
|
||||
if (self.clicked == False):
|
||||
self.searchvar.set("")
|
||||
self.search.config(fg="black")
|
||||
self.clicked = True
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
||||
|
||||
def search_internet(self, event):
|
||||
desktopLog.debug("Running search_internet")
|
||||
# TODO: Find a way to implement a browser
|
||||
try:
|
||||
webbrowser.open_new_tab("https://www.google.co.uk/#q=" + self.searchvar.get().replace(" ", "+"))
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
||||
|
||||
def reposition(self, event):
|
||||
desktopLog.debug("Running reposition")
|
||||
try:
|
||||
self.cHeight = self.window.winfo_height()
|
||||
self.cWidth = self.window.winfo_width()
|
||||
|
||||
self.centerWidth = self.window.winfo_x() + int(int(self.cWidth) / 2)
|
||||
self.centerHeight = self.window.winfo_y() + int(int(self.cHeight) / 2)
|
||||
|
||||
self.screenCenter = str(self.centerWidth) + "+" + str(self.centerHeight)
|
||||
|
||||
# self.startPic.place_configure(x=int(0), y=int(self.cHeight) - 55)
|
||||
|
||||
self.search.place_configure(x=57, y=int(self.cHeight) - 55, height=55, width=200)
|
||||
|
||||
# versionText.place(x=int(cWidth) - 300, y=int(cHeight) - 120)
|
||||
|
||||
self.toolbar.place_configure(x=258, y=int(self.cHeight) - 55, height=55, width=int(self.cWidth))
|
||||
|
||||
self.notifcationBar.place_configure(x=int(self.cWidth) - 500, y=int(self.cHeight) - 55, height=55,
|
||||
width=500)
|
||||
|
||||
self.windowX = self.window.winfo_x()
|
||||
self.windowY = (self.window.winfo_y() + self.window.winfo_height())
|
||||
|
||||
# displayTime.pack_configure(side=RIGHT)
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
||||
|
||||
def fullScreen(self, event):
|
||||
desktopLog.debug("Running fullscreen")
|
||||
try:
|
||||
if self.max == 0:
|
||||
self.window.attributes('-fullscreen', True)
|
||||
self.max = 1
|
||||
else:
|
||||
self.window.attributes('-fullscreen', False)
|
||||
self.max = 0
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
||||
|
||||
def clockTick(self):
|
||||
desktopLog.debug("Running clockTick")
|
||||
try:
|
||||
self.desktopRefresh()
|
||||
# cTime = time.strftime("%H:%M:%S")
|
||||
# print(cTime)
|
||||
self.cTime = time.strftime("%H:%M")
|
||||
if self.cTime != self.time1:
|
||||
self.time1 = self.cTime
|
||||
self.displayTime.configure(text=self.cTime)
|
||||
self.displayTime.after(1000, self.clockTick)
|
||||
else:
|
||||
self.displayTime.after(1000, self.clockTick)
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
||||
|
||||
def createSearch(self):
|
||||
desktopLog.debug("Running createSearch")
|
||||
try:
|
||||
self.searchText = Label(self.window, text="Search for: ")
|
||||
self.searchvar = StringVar()
|
||||
self.search = Entry(self.window, textvariable=self.searchvar, font=(14), bg=self.menuColour)
|
||||
self.search.bind("<Button-1>", self.box)
|
||||
self.search.bind("<Return>", self.search_internet)
|
||||
self.search.place(x=57, y=350, height=50, width=100)
|
||||
self.search.insert(0, "Search")
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
||||
|
||||
def contextMenuPopup(self, event):
|
||||
desktopLog.debug("Running contextMenuPopup")
|
||||
try:
|
||||
# start.start(self.menuColour, event.x_root, event.y_root)
|
||||
self.contextMenu.post(event.x_root, event.y_root)
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
||||
|
||||
def nothing(self):
|
||||
pass
|
||||
|
||||
def addContextMenuEntry(self, label="New Label", command=nothing, state=NORMAL):
|
||||
self.contextMenu.add_command(label=label, command=command, state=state)
|
||||
|
||||
def createContextMenu(self):
|
||||
desktopLog.debug("Running createContextMenu")
|
||||
try:
|
||||
self.contextMenu = Menu(self.window, tearoff=0)
|
||||
|
||||
self.contextMenu.add_command(label="Refresh", command=self.desktopRefresh)
|
||||
self.contextMenu.add_command(label="Jpad", command=jpad.jpadEditor)
|
||||
self.contextMenu.add_command(label="File Explorer", state=DISABLED)
|
||||
self.contextMenu.add_command(label="Hardware Monitor", state=DISABLED)
|
||||
self.contextMenu.add_command(label="Music Player", state=DISABLED)
|
||||
self.contextMenu.add_command(label="Info", state=DISABLED)
|
||||
self.contextMenu.add_command(label="Terminal", state=DISABLED)
|
||||
self.contextMenu.add_command(label="Settings", state=DISABLED)
|
||||
self.contextMenu.add_command(label="Restart", state=DISABLED)
|
||||
self.contextMenu.add_command(label="Shutdown", command=sys.exit)
|
||||
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
||||
|
||||
def desktopRefresh(self):
|
||||
try:
|
||||
desktopLog.debug("Running desktopRefresh")
|
||||
self.fileImage = PhotoImage(file="JDE/Images/file.png")
|
||||
self.f = []
|
||||
self.l = []
|
||||
fName = []
|
||||
self.place = []
|
||||
files = -1
|
||||
self.space = 80
|
||||
|
||||
prefix = self.user_dir
|
||||
|
||||
# prefix = os.path.expanduser("~")
|
||||
def openFile(self):
|
||||
# print(fName)
|
||||
self.fileURL = prefix + "/Desktop/" + str(fName[files])
|
||||
# print(fileURL)
|
||||
self.a = jpad
|
||||
self.a.jpadEditor(str(self.fileURL))
|
||||
|
||||
def openFolder(self):
|
||||
self.folderURL = prefix + "/Desktop/" + str(fName[files])
|
||||
self.file_Explorer(self.folderURL)
|
||||
|
||||
try:
|
||||
for self.file in os.listdir(self.prefix + "/Desktop"):
|
||||
if self.file not in fName:
|
||||
self.l.append(Label(self.window, text=self.file, font=("Arial", 11, "bold")))
|
||||
|
||||
files += 1
|
||||
|
||||
fName.append(self.file)
|
||||
self.place.append(files)
|
||||
|
||||
self.space += 80
|
||||
|
||||
self.f.append(Button(self.window, image=self.fileImage))
|
||||
|
||||
self.f[files].place(x=int(80), y=int(20) + self.space, width=40, height=40)
|
||||
|
||||
if ".txt" in self.file:
|
||||
self.f[files].bind("<Double-Button-1>", openFile)
|
||||
elif ".py" in self.file:
|
||||
self.f[files].bind("<Double-Button-1>", openFile)
|
||||
elif ".pyw" in self.file:
|
||||
self.f[files].bind("<Double-Button-1>", openFile)
|
||||
elif os.path.isdir(prefix + "/Desktop/" + self.file):
|
||||
self.f[files].bind("<Double-Button-1>", openFolder)
|
||||
else:
|
||||
pass
|
||||
self.l[files].place(x=int(100), y=int(70) + self.space, anchor=CENTER)
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
||||
|
||||
def refresh(self):
|
||||
desktopLog.debug("Running refresh")
|
||||
try:
|
||||
self.desktopRefresh()
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
||||
|
||||
def createStart(self):
|
||||
desktopLog.debug("Running createStartPic")
|
||||
try:
|
||||
start.start(self.menuColour, int(0), int(self.window.winfo_height()))
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
||||
pass
|
||||
|
||||
def createBackground(self):
|
||||
try:
|
||||
desktopLog.debug("Running createBackground")
|
||||
self.background_image = PhotoImage(file=self.background)
|
||||
self.canvas.create_image(0, 0, image=self.background_image, anchor=NW)
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
||||
|
||||
def createIcon(self):
|
||||
desktopLog.debug("Running createIcon")
|
||||
try:
|
||||
self.window.wm_iconbitmap("System/JordonOS Logo.ico")
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
||||
|
||||
def createWindow(self):
|
||||
desktopLog.debug("Running createWindow")
|
||||
try:
|
||||
self.window = Tk()
|
||||
self.window.title("Jordon's Desktop Environment")
|
||||
self.window.geometry(self.widthHeight)
|
||||
self.window.minsize(640, 360)
|
||||
self.windowX = self.window.winfo_x()
|
||||
self.windowY = self.window.winfo_y()
|
||||
|
||||
self.canvas = Canvas(self.window, width=self.width, height=self.height)
|
||||
self.canvas.pack(expand=YES, fill=BOTH)
|
||||
|
||||
self.toolbar = Frame(self.window, bg=self.menuColour)
|
||||
self.toolbar.place(x=0, y=int(self.height) - 55)
|
||||
|
||||
self.notifcationBar = Frame(self.window, bg=self.menuColour)
|
||||
self.notifcationBar.place(x=int(self.width) - 100, y=int(self.height) - 55)
|
||||
|
||||
self.window.attributes('-fullscreen', False)
|
||||
self.max = 0
|
||||
|
||||
self.displayTime = Label(self.notifcationBar, text=self.cTime, bg=self.menuColour, font=("System", 20))
|
||||
self.displayTime.pack(side=RIGHT)
|
||||
|
||||
self.window.bind("<F5>", self.refresh)
|
||||
|
||||
self.window.bind("<Escape>", self.fullScreen)
|
||||
self.window.bind("<Configure>", self.reposition)
|
||||
|
||||
self.window.bind("<Button-3>", self.contextMenuPopup)
|
||||
|
||||
self.createBackground()
|
||||
self.createIcon()
|
||||
self.createSearch()
|
||||
self.createContextMenu()
|
||||
self.clockTick()
|
||||
|
||||
self.window.mainloop()
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
||||
|
||||
def __init__(self, windowTitle="Desktop Environment", width="1920", height="1080", minWidth="", username=""):
|
||||
desktopLog.debug("Running __init__")
|
||||
try:
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.widthHeight = str(self.width + "x" + self.height)
|
||||
self.windowTitle = windowTitle
|
||||
self.cTime = time.strftime("%H:%M")
|
||||
self.time1 = ""
|
||||
self.menuColour = config["colour"].replace("\n", "")
|
||||
self.startMenuPic = config["startPic"].replace("\n", "")
|
||||
self.background = config["background"]
|
||||
self.user_dir = config["userDirs"] + username + "/"
|
||||
self.prefix = self.user_dir
|
||||
self.clicked = 0
|
||||
|
||||
self.createWindow()
|
||||
|
||||
except Exception as e:
|
||||
desktopLog.error(str(e))
|
130
JDE/Interfaces/login.py
Normal file
130
JDE/Interfaces/login.py
Normal file
|
@ -0,0 +1,130 @@
|
|||
import logging
|
||||
from tkinter import *
|
||||
|
||||
loginLog = logging.getLogger("login.py")
|
||||
|
||||
|
||||
class login:
|
||||
def reposition(self, event):
|
||||
loginLog.debug("Running reposition")
|
||||
self.frame.place_configure(x=int(self.window.winfo_width() / 3), y=self.window.winfo_height() / 3,
|
||||
width=int(int(self.window.winfo_width()) / 3),
|
||||
height=int(int(self.window.winfo_height()) / 3))
|
||||
|
||||
def callback(self, event):
|
||||
loginLog.debug("Running callback")
|
||||
self.username = self.user.get()
|
||||
|
||||
try:
|
||||
self.file = open(self.userDirs + self.username.lower() + ".profile", "r")
|
||||
self.file.close()
|
||||
except:
|
||||
self.message.configure(text="Err: Username or password is incorrect!")
|
||||
self.file = open(self.userDirs + self.username.lower() + ".profile", "r")
|
||||
|
||||
self.line = self.file.readlines()
|
||||
|
||||
self.password = self.passw.get()
|
||||
if self.username == self.line[1].strip() and self.password == self.line[2].strip():
|
||||
self.message.configure(text="Logged in.")
|
||||
self.active = self.username
|
||||
self.tmp = open("active", "w")
|
||||
self.tmp.write(self.active)
|
||||
self.window.destroy()
|
||||
# user_dir = line[4]
|
||||
else:
|
||||
self.message.configure(text="Err: Username and password don't match the profile")
|
||||
|
||||
def createWidgets(self):
|
||||
loginLog.debug("Running createWidgets")
|
||||
self.titleLabel = Label(self.frame, text="Login to " + self.windowTitle + "\n", bg=self.bgColour)
|
||||
self.usertitle = Label(self.frame, text="---Username---", bg=self.bgColour)
|
||||
self.passtitle = Label(self.frame, text="---Password---", bg=self.bgColour)
|
||||
self.message = Label(self.frame, bg=self.bgColour)
|
||||
self.user = Entry(self.frame)
|
||||
self.passw = Entry(self.frame, show="*")
|
||||
self.go = Button(self.frame, text="Log in!", bg="#00FF00")
|
||||
|
||||
self.titleLabel.pack()
|
||||
self.usertitle.pack()
|
||||
self.user.pack()
|
||||
self.passtitle.pack()
|
||||
self.passw.pack()
|
||||
self.go.pack()
|
||||
self.message.pack()
|
||||
|
||||
self.user.focus()
|
||||
|
||||
self.go.bind("<Button-1>", self.callback)
|
||||
self.go.bind("<Return>", self.callback)
|
||||
self.passw.bind("<Return>", self.callback)
|
||||
self.window.bind("<Configure>", self.reposition)
|
||||
|
||||
self.window.mainloop()
|
||||
|
||||
def createColour(self):
|
||||
loginLog.debug("Running createColour")
|
||||
try:
|
||||
self.window.configure(bg=self.bgColour)
|
||||
except:
|
||||
pass
|
||||
|
||||
def createIcon(self):
|
||||
loginLog.debug("Running createIcon")
|
||||
try:
|
||||
self.window.wm_iconbitmap(self.icon)
|
||||
except:
|
||||
pass
|
||||
|
||||
def createBackground(self):
|
||||
loginLog.debug("Running createBackground")
|
||||
try:
|
||||
self.background_image = PhotoImage(file=self.bg)
|
||||
self.canvas.create_image(0, 0, image=self.background_image, anchor=NW)
|
||||
self.canvas.pack(expand=YES, fill=BOTH)
|
||||
except Exception as e:
|
||||
loginLog.error(str(e))
|
||||
|
||||
def fullScreen(self, event):
|
||||
loginLog.debug("Running fullscreen")
|
||||
if self.max == 0:
|
||||
self.window.attributes('-fullscreen', True)
|
||||
self.max = 1
|
||||
else:
|
||||
self.window.attributes('-fullscreen', False)
|
||||
self.max = 0
|
||||
|
||||
def createWindow(self):
|
||||
loginLog.debug("Running createWindow")
|
||||
self.window = Tk()
|
||||
self.window.title(self.windowTitle)
|
||||
self.window.geometry(self.widthHeight)
|
||||
self.canvas = Canvas(self.window, width=self.bgWidth, height=self.bgHeight)
|
||||
self.frame = Frame(self.canvas)
|
||||
self.frame.configure(bg=self.bgColour)
|
||||
|
||||
self.canvas.pack()
|
||||
|
||||
self.window.attributes('-fullscreen', True)
|
||||
self.max = 1
|
||||
self.window.bind("<Escape>", self.fullScreen)
|
||||
|
||||
def __init__(self, windowTitle="Login Window", widthHeight="1920x1080", icon="", bgColour=None, bg=None,
|
||||
bgWidth="350", bgHeight="250",
|
||||
userDirs=""):
|
||||
loginLog.debug("Running __init__")
|
||||
self.windowTitle = windowTitle
|
||||
self.widthHeight = widthHeight
|
||||
self.icon = icon
|
||||
self.bgColour = bgColour
|
||||
self.bg = bg
|
||||
self.bgWidth = bgWidth
|
||||
self.bgHeight = bgHeight
|
||||
self.userDirs = userDirs
|
||||
self.username = ""
|
||||
self.active = ""
|
||||
|
||||
self.createWindow()
|
||||
self.createBackground()
|
||||
self.createIcon()
|
||||
self.createWidgets()
|
64
JDE/Interfaces/start.py
Normal file
64
JDE/Interfaces/start.py
Normal file
|
@ -0,0 +1,64 @@
|
|||
from tkinter import *
|
||||
|
||||
|
||||
class start:
|
||||
def createWidgets(self):
|
||||
self.allPrograms = Frame(self.window)
|
||||
self.allPrograms.configure(bg=self.menuColour)
|
||||
|
||||
self.window.geometry("242x310")
|
||||
|
||||
self.hardwareMonitorButton = Button(self.allPrograms, text="Hardware Monitor", state=DISABLED,
|
||||
width=100,
|
||||
bg=self.menuColour)
|
||||
self.musicPlayerButton = Button(self.allPrograms, text="Music Player - Experimental", state=DISABLED,
|
||||
width=100, bg=self.menuColour)
|
||||
self.infoButton = Button(self.allPrograms, text="Glass OS Info Panel", state=DISABLED, width=100,
|
||||
bg=self.menuColour)
|
||||
self.CustomAppLauncherButton = Button(self.allPrograms, text="Custom App Launcher", state=DISABLED, width=100,
|
||||
bg=self.menuColour)
|
||||
self.terminalButton = Button(self.allPrograms, text="Terminal", state=DISABLED, width=100, bg=self.menuColour)
|
||||
self.restartButton = Button(self.allPrograms, text="Restart", state=DISABLED, width=100, bg=self.menuColour)
|
||||
self.jpadButton = Button(self.allPrograms, text="Jpad", state=DISABLED, width=100, bg=self.menuColour)
|
||||
self.chkUpdates = Button(self.allPrograms, text="Check for Updates", state=DISABLED, width=100,
|
||||
bg=self.menuColour)
|
||||
self.settingsButton = Button(self.allPrograms, text="Settings", state=DISABLED, width=100, bg=self.menuColour)
|
||||
self.fileExplorer = Button(self.allPrograms, text="File Explorer", state=DISABLED, width=100,
|
||||
bg=self.menuColour)
|
||||
self.shutdown = Button(self.allPrograms, text="Shutdown", command=sys.exit, width=100, bg=self.menuColour)
|
||||
|
||||
self.musicPlayerButton.pack()
|
||||
self.jpadButton.pack()
|
||||
self.chkUpdates.pack()
|
||||
self.CustomAppLauncherButton.pack()
|
||||
self.fileExplorer.pack()
|
||||
self.infoButton.pack()
|
||||
self.hardwareMonitorButton.pack()
|
||||
self.settingsButton.pack()
|
||||
self.terminalButton.pack()
|
||||
self.restartButton.pack()
|
||||
self.shutdown.pack()
|
||||
|
||||
self.allPrograms.pack()
|
||||
|
||||
def createWindow(self):
|
||||
self.window = Tk()
|
||||
self.window.configure(bg=self.menuColour)
|
||||
self.window.focus()
|
||||
self.window.title("Start")
|
||||
|
||||
self.createWidgets()
|
||||
|
||||
def noFocus(event):
|
||||
self.window.destroy()
|
||||
|
||||
self.window.bind("<FocusOut>", noFocus)
|
||||
|
||||
self.window.mainloop()
|
||||
|
||||
def __init__(self, colour=None, posX=0, posY=1000):
|
||||
self.menuColour = colour
|
||||
self.root_windowX = posX
|
||||
self.root_windowY = posY
|
||||
|
||||
self.createWindow()
|
53
JDE/JDE.py
Normal file
53
JDE/JDE.py
Normal file
|
@ -0,0 +1,53 @@
|
|||
__author__ = "Jordonbc"
|
||||
import logging
|
||||
import time
|
||||
|
||||
logging.basicConfig(filename='JDE/Logs/' + str(time.strftime('%d-%m-%Y-%H-%M%p') + ".log"), level=logging.DEBUG)
|
||||
jdeLog = logging.getLogger("JDE.py")
|
||||
|
||||
jdeLog.info("Importing tkinter")
|
||||
try:
|
||||
from tkinter import *
|
||||
|
||||
jdeLog.info("Import Successful")
|
||||
except Exception as e:
|
||||
jdeLog.critical(str(e))
|
||||
|
||||
jdeLog.info("Importing os")
|
||||
try:
|
||||
import os
|
||||
|
||||
jdeLog.info("Import Successful")
|
||||
except Exception as e:
|
||||
jdeLog.critical(str(e))
|
||||
|
||||
jdeLog.info("Importing JDE/Interfaces/login")
|
||||
try:
|
||||
from JDE.Interfaces import login
|
||||
|
||||
jdeLog.info("Import Successful!")
|
||||
except Exception as e:
|
||||
jdeLog.critical(str(e))
|
||||
|
||||
jdeLog.info("Importing JDE/Interfaces/desktop")
|
||||
try:
|
||||
from JDE.Interfaces import desktop
|
||||
|
||||
jdeLog.info("Import Successful!")
|
||||
except Exception as e:
|
||||
jdeLog.critical(str(e))
|
||||
|
||||
try:
|
||||
loginApp = login.login
|
||||
loginApp(windowTitle="JDE Login", widthHeight="1280x800", userDirs="Users/", bg="JDE/Images/background.png")
|
||||
userFile = open("active", "r")
|
||||
username = userFile.read()
|
||||
userFile.close()
|
||||
os.remove("active")
|
||||
|
||||
print(username)
|
||||
|
||||
desktopApp = desktop.desktop
|
||||
desktopApp(username=username)
|
||||
except Exception as e:
|
||||
jdeLog.critical(str(e))
|
28
JDE/Recent
Normal file
28
JDE/Recent
Normal file
|
@ -0,0 +1,28 @@
|
|||
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
||||
jpad
|
7
JDE/Settings/settings.conf
Normal file
7
JDE/Settings/settings.conf
Normal file
|
@ -0,0 +1,7 @@
|
|||
width = "1024"
|
||||
height = "600"
|
||||
userDirs = "Users/"
|
||||
background = "JDE/Images/background.png"
|
||||
colour = "#a0fd44"
|
||||
startPic = "JDE/Images/start.png"
|
||||
fullStart = "0"
|
213
Programs/jpad.py
Normal file
213
Programs/jpad.py
Normal file
|
@ -0,0 +1,213 @@
|
|||
import logging
|
||||
from tkinter import *
|
||||
from tkinter.filedialog import askopenfilename, asksaveasfilename
|
||||
|
||||
jpadLog = logging.getLogger("jpad.py")
|
||||
|
||||
jpadLog.debug("Atempting to read settings file")
|
||||
try:
|
||||
config = {}
|
||||
exec(open("JDE/Settings/settings.conf").read(), config)
|
||||
jpadLog.debug("System settings Detected!")
|
||||
except Exception as e:
|
||||
jpadLog.error(str(e))
|
||||
|
||||
|
||||
class jpadEditor:
|
||||
def minimize(self):
|
||||
jpadLog.debug("Running minimize")
|
||||
try:
|
||||
self.appFocus = 0
|
||||
except Exception as e:
|
||||
jpadLog.error(str(e))
|
||||
|
||||
def closeApp(self):
|
||||
jpadLog.debug("Running closeApp")
|
||||
try:
|
||||
# self.appIcon.destroy()
|
||||
self.window.destroy()
|
||||
except Exception as e:
|
||||
jpadLog.error(str(e))
|
||||
|
||||
def focusApp(self):
|
||||
jpadLog.debug("Running focusApp")
|
||||
try:
|
||||
if self.appFocus == 0:
|
||||
self.window.focus_force()
|
||||
self.appFocus = 1
|
||||
|
||||
else:
|
||||
self.appFocus = 0
|
||||
self.window.focus_set()
|
||||
except Exception as e:
|
||||
jpadLog.error(str(e))
|
||||
|
||||
def createMenu(self):
|
||||
jpadLog.debug("Running createMenu")
|
||||
try:
|
||||
self.menu = Menu(self.window)
|
||||
self.window.config(menu=self.menu)
|
||||
self.filemenu = Menu(self.menu)
|
||||
self.menu.add_cascade(label="File", menu=self.filemenu)
|
||||
self.filemenu.add_command(label="New", command=self.new)
|
||||
self.filemenu.add_command(label="Open...", command=self.open_command)
|
||||
self.filemenu.add_command(label="Save", command=self.save_command)
|
||||
self.filemenu.add_command(label="Save As", command=self.saveAs_command)
|
||||
self.filemenu.add_separator()
|
||||
self.filemenu.add_command(label="Exit", command=self.exit_command)
|
||||
|
||||
self.fontMenu = Menu(self.menu)
|
||||
self.menu.add_cascade(label="Font", menu=self.fontMenu)
|
||||
self.fontMenu.add_command(label="font", command=self.chfont)
|
||||
except Exception as e:
|
||||
jpadLog.error(str(e))
|
||||
|
||||
def new(self):
|
||||
jpadLog.debug("Running new")
|
||||
try:
|
||||
self.window.title("Jpad Text Editor" + " File: New File")
|
||||
self.textPad.delete(0.0, END)
|
||||
except Exception as e:
|
||||
jpadLog.error(str(e))
|
||||
|
||||
def exit_command(self):
|
||||
jpadLog.debug("Running exit_command")
|
||||
try:
|
||||
self.closeApp()
|
||||
except Exception as e:
|
||||
jpadLog.error(str(e))
|
||||
|
||||
def saveAs_command(self):
|
||||
jpadLog.debug("Running saveAs_command")
|
||||
try:
|
||||
self.jpadFile = asksaveasfilename(defaultextension=".txt",
|
||||
filetypes=[("Text Files", ".txt"), ("Python .py", ".py"),
|
||||
("Python .pyw", ".pyw"),
|
||||
("All Files", ".*")])
|
||||
self.window.title("Jpad Text Editor" + " File: " + str(self.jpadFile))
|
||||
self.jpadFile = open(str(self.jpadFile), "w")
|
||||
if self.jpadFile != None:
|
||||
# slice off the last character from get, as an extra return is added
|
||||
self.data = self.textPad.get(0.0, END)
|
||||
self.jpadFile.write(self.data)
|
||||
self.jpadFile.close()
|
||||
except Exception as e:
|
||||
jpadLog.error(str(e))
|
||||
|
||||
def save_command(self):
|
||||
jpadLog.debug("Running save_command")
|
||||
try:
|
||||
self.jpadFile = open(str(self.jpadFile), "w")
|
||||
if self.jpadFile != None:
|
||||
# slice off the last character from get, as an extra return is added
|
||||
self.data = self.textPad.get(0.0, END)
|
||||
self.jpadFile.write(self.data)
|
||||
self.jpadFile.close()
|
||||
except Exception as e:
|
||||
jpadLog.error(str(e))
|
||||
|
||||
def open_command(self):
|
||||
jpadLog.debug("Running open_command")
|
||||
try:
|
||||
self.jpadFile = askopenfilename(defaultextension=".txt",
|
||||
filetypes=[("Text Files", ".txt"), ("Python .py", ".py"),
|
||||
("Python .pyw", ".pyw"),
|
||||
("All Files", ".*")], )
|
||||
|
||||
self.window.title("Jpad Text Editor" + " File: " + str(self.jpadFile))
|
||||
self.jpadFile = open(str(self.jpadFile), "r")
|
||||
if self.jpadFile != None:
|
||||
self.contents = self.jpadFile.read()
|
||||
self.textPad.delete(0.0, END)
|
||||
self.textPad.insert(0.0, self.contents)
|
||||
self.jpadFile.close()
|
||||
except Exception as e:
|
||||
jpadLog.error(str(e))
|
||||
|
||||
def chfont(self):
|
||||
def apply(self):
|
||||
try:
|
||||
self.textPad.configure(font=(self.font1.get(), int(self.font2.get()), self.font3.get()))
|
||||
self.font[0] = self.font1.get()
|
||||
self.font[1] = self.font2.get()
|
||||
self.font[2] = self.font3.get()
|
||||
|
||||
self.rootFont.destroy()
|
||||
except:
|
||||
self.msg.configure(text="Whoops, something went wrong while applying your font!")
|
||||
|
||||
self.rootFont = Tk()
|
||||
self.rootFont.title("Font")
|
||||
self.rootFont.geometry("320x110")
|
||||
|
||||
self.font1 = Entry(self.rootFont)
|
||||
self.font2 = Entry(self.rootFont)
|
||||
self.font3 = Entry(self.rootFont)
|
||||
|
||||
self.font1.insert(0, self.font[0])
|
||||
self.font2.insert(0, self.font[1])
|
||||
self.font3.insert(0, self.font[2])
|
||||
|
||||
self.applyButton = Button(self.rootFont, text="Apply Font", command=apply)
|
||||
self.msg = Label(self.rootFont)
|
||||
|
||||
self.font1.pack()
|
||||
self.font2.pack()
|
||||
self.font3.pack()
|
||||
self.applyButton.pack()
|
||||
self.msg.pack()
|
||||
|
||||
self.rootFont.mainloop()
|
||||
|
||||
def createWidgets(self):
|
||||
self.textPad = Text(self.window)
|
||||
self.textPad.configure(bg=self.menuColour)
|
||||
self.textPad.configure(font=(self.font[0], int(self.font[1]), self.font[2]))
|
||||
self.textPad.focus()
|
||||
|
||||
if self.jpadFile != None:
|
||||
self.window.title("Jpad Text Editor" + " File: " + str(self.jpadFile))
|
||||
self.jpadFile = open(str(self.jpadFile), "r")
|
||||
self.contents = self.jpadFile.read()
|
||||
self.textPad.delete(0.0, END)
|
||||
self.textPad.insert(0.0, self.contents)
|
||||
self.jpadFile.close()
|
||||
|
||||
self.textPad.pack(expand=YES, fill=BOTH)
|
||||
|
||||
def createWindow(self):
|
||||
self.window = Tk()
|
||||
self.sWidth = self.window.winfo_screenwidth()
|
||||
self.sHeight = self.window.winfo_screenheight()
|
||||
self.window.title("Jpad")
|
||||
self.window.geometry(self.widthHeight)
|
||||
self.window.maxsize(self.sWidth, self.sHeight)
|
||||
self.window.minsize("200", "200")
|
||||
self.createWidgets()
|
||||
self.createMenu()
|
||||
|
||||
self.window.bind("<Unmap>", self.minimize)
|
||||
self.window.protocol("WM_DELETE_WINDOW", self.closeApp)
|
||||
|
||||
self.window.mainloop()
|
||||
|
||||
def __init__(self, file=None):
|
||||
self.recentAdd = open("JDE/Recent", "a")
|
||||
self.recentAdd.write("\n")
|
||||
self.recentAdd.write("jpad")
|
||||
self.recentAdd.close()
|
||||
self.jpadFile = file
|
||||
self.width = "500"
|
||||
self.height = "400"
|
||||
self.appFocus = 1
|
||||
self.widthHeight = self.width + "x" + self.height
|
||||
self.menuColour = config["colour"].replace("\n", "")
|
||||
self.font = ["Arial", "11", "normal"]
|
||||
|
||||
try:
|
||||
self.appIcon = Button(self.toolbar, text="Jpad", command=self.focusApp)
|
||||
self.appIcon.pack(side=LEFT, fill=Y)
|
||||
except:
|
||||
pass
|
||||
|
||||
self.createWindow()
|
270
Programs/minesweeper.py
Normal file
270
Programs/minesweeper.py
Normal file
|
@ -0,0 +1,270 @@
|
|||
import random
|
||||
from tkinter import *
|
||||
from tkinter import messagebox
|
||||
|
||||
|
||||
def mine_sweeper(colour="#39d972"):
|
||||
class MineSweeperCell(Label):
|
||||
'''Creates a minesweeper square that is part of a grid'''
|
||||
|
||||
def __init__(self, master):
|
||||
'''Makes an unmarked minesweeper grid square; 0 represents blank and 9 represents bomb'''
|
||||
# create cell label
|
||||
Label.__init__(self, master, height=1, width=2, text='', bg=colour, bd=5, font=('Arial', 10), relief=RAISED)
|
||||
self.value = '' # store cell value
|
||||
self.clicked = False # store whether it is clicked
|
||||
self.flagged = False # store whether it is flagged
|
||||
self.checked = False # store whether it has been checked (for 0's)
|
||||
# color dictionary
|
||||
self.colorMap = ['', 'blue', 'darkgreen', 'red', 'purple', 'maroon', 'cyan', 'black', 'gray']
|
||||
# attaches mouse clicks to functions
|
||||
self.bind('<Button-1>', self.reveal)
|
||||
self.bind('<Button-3>', self.flag)
|
||||
|
||||
def get_value(self):
|
||||
'''Returns value of cell'''
|
||||
return self.value
|
||||
|
||||
def is_clicked(self):
|
||||
'''Tells if cell has been clicked'''
|
||||
return self.clicked
|
||||
|
||||
def is_flagged(self):
|
||||
'''Tells if cell is flagged'''
|
||||
return self.flagged
|
||||
|
||||
def flag(self, event):
|
||||
'''Flags the square if player believes there is a bomb'''
|
||||
if self.flagged == False and self.clicked == False and int(
|
||||
self.master.flags) > 0 and self.master.winner == False:
|
||||
# if no flag
|
||||
self['text'] = '*'
|
||||
self.master.subFlag() # subtract from remaining bombs
|
||||
self.flagged = True # set self.flagged to true
|
||||
elif self.flagged == True and self.clicked == False and int(self.master.flags) < int(
|
||||
self.master.bombs) and self.master.winner == False: # if it is already flagged
|
||||
self['text'] = '' # remove flag
|
||||
self.master.addFlag() # add to remaining bombs
|
||||
self.flagged = False # set self.flagged to False
|
||||
|
||||
def set_value(self, value):
|
||||
'''Sets the value of the cell'''
|
||||
self.value = value
|
||||
|
||||
def reveal(self, event):
|
||||
'''Reveals the hidden cell value'''
|
||||
if self.clicked == False:
|
||||
if 0 < self.value < 9:
|
||||
if self.flagged == False and self.master.loser == False: # checks if it is a valid click
|
||||
self['relief'] = SUNKEN
|
||||
# set text and color
|
||||
self['text'] = str(self.value)
|
||||
self['fg'] = self.colorMap[self.value]
|
||||
self['bg'] = 'gray65'
|
||||
self["bd"] = 5
|
||||
self.clicked = True
|
||||
self.master.CheckWin()
|
||||
elif self.value == 9:
|
||||
if self.master.winner == False and self.flagged == False: # if it is a bomb
|
||||
self['text'] = '*' # make text a bomb
|
||||
self['bg'] = 'red' # make background red
|
||||
self["bd"] = 5
|
||||
self['relief'] = SUNKEN
|
||||
self.clicked = True
|
||||
self.master.CheckLoss()
|
||||
elif self.value == 0:
|
||||
if self.flagged == False and self.master.loser == False:
|
||||
self['text'] = ''
|
||||
self.master.uncover_other_blank(self)
|
||||
self['relief'] = SUNKEN
|
||||
self['bg'] = 'gray65'
|
||||
self["bd"] = 5
|
||||
self.clicked = True
|
||||
self.master.CheckWin()
|
||||
|
||||
def expose(self):
|
||||
'''Exposes surrounding zeros'''
|
||||
if self.clicked == False:
|
||||
if 0 < self.value < 9:
|
||||
if self.flagged == False and self.master.loser == False:
|
||||
self['text'] = str(self.value) # set text and color
|
||||
self['fg'] = self.colorMap[self.value]
|
||||
self['relief'] = SUNKEN
|
||||
self['bg'] = 'gray65'
|
||||
self["bd"] = 5
|
||||
self.clicked = True
|
||||
self.master.CheckWin()
|
||||
elif self.value == 9:
|
||||
if self.flagged == False: # if it is a bomb
|
||||
self['text'] = '*' # make text a bomb
|
||||
self['bg'] = 'red' # make background red
|
||||
self["bd"] = 5
|
||||
self['relief'] = SUNKEN
|
||||
self.clicked = True
|
||||
elif self.value == 0:
|
||||
if self.flagged == False and self.master.loser == False:
|
||||
self['text'] = ''
|
||||
self.master.uncover_other_blank(self)
|
||||
self['relief'] = SUNKEN
|
||||
self['bg'] = 'gray65'
|
||||
self["bd"] = 5
|
||||
self.clicked = True
|
||||
self.master.CheckWin()
|
||||
|
||||
class MineSweeperGrid(Frame):
|
||||
'''Creates a minesweeper grid to play the game on'''
|
||||
|
||||
def __init__(self, master, width, height, numBombs):
|
||||
'''Creates a grid with the given width, height, and number of bombs'''
|
||||
Frame.__init__(self, master, bg=colour, bd=5)
|
||||
self.grid()
|
||||
# sets the number of bombs
|
||||
self.bombs = numBombs
|
||||
# sets the number of flags
|
||||
self.flags = numBombs
|
||||
# create something to set the bombs up around each square
|
||||
self.count = 0
|
||||
self.winner = False
|
||||
self.loser = False
|
||||
# create the label that will keep track of flags
|
||||
self.flagTrack = Label(self, text=self.flags, bg=colour, height=1, width=2, font=("Arial", 36))
|
||||
self.flagTrack.grid(row=height, columnspan=width)
|
||||
# create the bombs
|
||||
self.cells = {}
|
||||
for i in range(int(numBombs)):
|
||||
y = random.randint(0, int(width) - 1)
|
||||
x = random.randint(0, int(height) - 1)
|
||||
while (x, y) in self.cells.keys():
|
||||
y = random.randint(0, int(width) - 1)
|
||||
x = random.randint(0, int(height) - 1)
|
||||
self.cells[(x, y)] = MineSweeperCell(self)
|
||||
self.cells[(x, y)].set_value(9)
|
||||
self.cells[(x, y)].grid(row=x, column=y)
|
||||
# create the other cells
|
||||
for row in range(int(height)):
|
||||
for column in range(int(width)):
|
||||
if (row, column) not in self.cells.keys():
|
||||
self.count = 0
|
||||
if (row + 1, column) in self.cells.keys():
|
||||
if self.cells[(row + 1, column)].get_value() == 9:
|
||||
self.count = self.count + 1
|
||||
if (row + 1, column + 1) in self.cells.keys():
|
||||
if self.cells[(row + 1, column + 1)].get_value() == 9:
|
||||
self.count = self.count + 1
|
||||
if (row, column + 1) in self.cells.keys():
|
||||
if self.cells[(row, column + 1)].get_value() == 9:
|
||||
self.count = self.count + 1
|
||||
if (row - 1, column + 1) in self.cells.keys():
|
||||
if self.cells[(row - 1, column + 1)].get_value() == 9:
|
||||
self.count = self.count + 1
|
||||
if (row - 1, column) in self.cells.keys():
|
||||
if self.cells[(row - 1, column)].get_value() == 9:
|
||||
self.count = self.count + 1
|
||||
if (row - 1, column - 1) in self.cells.keys():
|
||||
if self.cells[(row - 1, column - 1)].get_value() == 9:
|
||||
self.count = self.count + 1
|
||||
if (row, column - 1) in self.cells.keys():
|
||||
if self.cells[(row, column - 1)].get_value() == 9:
|
||||
self.count = self.count + 1
|
||||
if (row + 1, column - 1) in self.cells.keys():
|
||||
if self.cells[(row + 1, column - 1)].get_value() == 9:
|
||||
self.count = self.count + 1
|
||||
self.cells[(row, column)] = MineSweeperCell(self)
|
||||
self.cells[(row, column)].set_value(self.count)
|
||||
self.cells[(row, column)].grid(row=row, column=column)
|
||||
|
||||
def subFlag(self):
|
||||
'''Subtracts one from the flagcount'''
|
||||
self.flags = int(self.flags) - 1
|
||||
self.flagTrack['text'] = str(self.flags)
|
||||
|
||||
def addFlag(self):
|
||||
'''Adds one from the flagcount'''
|
||||
self.flags = int(self.flags) + 1
|
||||
self.flagTrack['text'] = str(self.flags)
|
||||
|
||||
def uncover_other_blank(self, cell):
|
||||
'''Uncovers all blank squares adjacent to the marked square'''
|
||||
for coords, mine in self.cells.items():
|
||||
if mine == cell:
|
||||
c = coords
|
||||
x = int(float(c[0]))
|
||||
y = int(float(c[1]))
|
||||
cell.checked = True
|
||||
# checks all cells in radius
|
||||
if (x + 1, y) in self.cells.keys():
|
||||
if self.cells[(x + 1, y)].checked == False:
|
||||
self.cells[(x + 1, y)].expose()
|
||||
if (x + 1, y + 1) in self.cells.keys():
|
||||
if self.cells[(x + 1, y + 1)].checked == False:
|
||||
self.cells[(x + 1, y + 1)].expose()
|
||||
if (x, y + 1) in self.cells.keys():
|
||||
if self.cells[(x, y + 1)].checked == False:
|
||||
self.cells[(x, y + 1)].expose()
|
||||
if (x - 1, y + 1) in self.cells.keys():
|
||||
if self.cells[(x - 1, y + 1)].checked == False:
|
||||
self.cells[(x - 1, y + 1)].expose()
|
||||
if (x - 1, y) in self.cells.keys():
|
||||
if self.cells[(x - 1, y)].checked == False:
|
||||
self.cells[(x - 1, y)].expose()
|
||||
if (x - 1, y - 1) in self.cells.keys():
|
||||
if self.cells[(x - 1, y - 1)].checked == False:
|
||||
self.cells[(x - 1, y - 1)].expose()
|
||||
if (x, y - 1) in self.cells.keys():
|
||||
if self.cells[(x, y - 1)].checked == False:
|
||||
self.cells[(x, y - 1)].expose()
|
||||
if (x + 1, y - 1) in self.cells.keys():
|
||||
if self.cells[(x + 1, y - 1)].checked == False:
|
||||
self.cells[(x + 1, y - 1)].expose()
|
||||
|
||||
def CheckWin(self):
|
||||
'''Checks if player won'''
|
||||
doneList = []
|
||||
for key in self.cells.keys():
|
||||
if self.cells[key].clicked == True and self.cells[key].value != 9:
|
||||
doneList.append(self.cells[key])
|
||||
if len(doneList) == int(height) * int(width) - int(numBombs):
|
||||
messagebox.showinfo('Minesweeper', 'Congratulations -- you won!', parent=self)
|
||||
self.winner = True
|
||||
playagain()
|
||||
|
||||
def CheckLoss(self):
|
||||
'''Checks if player lost'''
|
||||
self.loser = True
|
||||
self.flagTrack['text'] = '0'
|
||||
messagebox._show('Minesweeper', 'You Lose!', parent=self)
|
||||
for key in self.cells.keys():
|
||||
if self.cells[key].value == 9:
|
||||
self.cells[key].flagged = False
|
||||
self.cells[key].expose()
|
||||
playagain()
|
||||
|
||||
def playagain():
|
||||
again = messagebox.askyesno("Minesweeper", "Do you want to play again?")
|
||||
if again == TRUE:
|
||||
root.destroy()
|
||||
__init__()
|
||||
|
||||
else:
|
||||
root.destroy()
|
||||
|
||||
def __init__():
|
||||
global width
|
||||
global height
|
||||
global numBombs
|
||||
width = 10
|
||||
height = 10
|
||||
numBombs = 30
|
||||
global root
|
||||
root = Tk()
|
||||
root.maxsize(270, 335)
|
||||
root.minsize(270, 335)
|
||||
root.title('Minesweeper')
|
||||
global game
|
||||
game = MineSweeperGrid(root, width, height, numBombs)
|
||||
game.mainloop()
|
||||
|
||||
__init__()
|
||||
|
||||
|
||||
mine_sweeper()
|
5
Users/test.profile
Normal file
5
Users/test.profile
Normal file
|
@ -0,0 +1,5 @@
|
|||
--==test==--
|
||||
test
|
||||
test
|
||||
1
|
||||
Users/test
|
1
Users/test/Desktop/test.txt
Normal file
1
Users/test/Desktop/test.txt
Normal file
|
@ -0,0 +1 @@
|
|||
test
|
1
run.py
Normal file
1
run.py
Normal file
|
@ -0,0 +1 @@
|
|||
from JDE import JDE
|
Reference in a new issue