My friends and I like to play Minecraft and Unturned and I have set up private servers for us as a result. However, it has gotten quite tedious having to search through all of my files to find the server locations every time we want to access it. I came up with a project that means creating a GUI with various Buttons and labels on it that opens different server files. What you see below is my current code for a single server:
from tkinter import*
import ctypes
root = Tk()
root.title("My Servers")
root.geometry("400x400")
def runNotepad():
ctypes.windll.shell32.ShellExecuteA("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Unturned\\UnturnedServer.exe", None, None, 10)
app = Frame(root)
app.grid()
btna = Button(app, text = 'Notepad', command=runNotepad)
btna.grid()
root.mainloop()
But when I click run it comes up with this error message:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", line 1533, in __call__
return self.func(*args)
File "E:/Python Programmes/OwainSimple.py", line 11, in runNotepad
ctypes.windll.shell32.ShellExecuteA("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Unturned\\UnturnedServer.exe", None, None, 10)
OSError: exception: access violation reading 0x0000000A
Can anybody tell me how to fix the error or generally get the program to work?
User contributions licensed under CC BY-SA 3.0