@bossotron13/

PositiveAfraidPoints

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
from tkinter import *
from tkinter import messagebox
import pymongo
import os
try:
  import dnspython
except ModuleNotFoundError:
  print("")

client = pymongo.MongoClient("mongodb+srv://idestroyyou4ever:[email protected]/test?retryWrites=true&w=majority")

ApplicationsDB = client["Applications"]

acceptedApplications = ApplicationsDB["Accepted_Applications"]
rejectApplications = ApplicationsDB["Rejected_Applications"]
pendingApplications = ApplicationsDB["Pending_Applications"]
players = acceptedApplications['players']

a = 0

def Message(title, message):
  messagebox.showerror(title, message)

def createChar(event):
    global Application, DOB, Age, FirstName,LastName, firstEntry, lastEntry, AgeEntry, DOBEntry, passEntry
    start.destroy()
    create = Tk()
    create.geometry('400x90')
    firstText = Label(create, text='First Name: ')
    firstText.grid(column=0, row=0)
    firstEntry = Entry(create)
    firstEntry.grid(column=1, row=0)
    lastText = Label(create, text='Last Name: ')
    lastText.grid(column=0, row=1)
    lastEntry = Entry(create)
    lastEntry.grid(column=1, row=1)
    AgeText = Label(create, text='Age: ')
    AgeText.grid(column=0, row=2)
    AgeEntry = Entry(create)
    AgeEntry.grid(column=1, row=2)
    DOBText = Label(create, text='DOB: ')
    DOBText.grid(column=2, row=0)
    DOBEntry = Entry(create)
    DOBEntry.grid(column=3, row=0)
    passText = Label(create, text='Password: ')
    passText.grid(column=0, row=3)
    passEntry = Entry(create)
    passEntry.grid(column=1, row=3)
    exText = Label(create, text='ex M:6/D:12/Y:1994')
    exText.grid(column=3, row=1)
    CreateAccount = Button(create, text='Register')
    CreateAccount.bind('<Button-1>', regButton)
    CreateAccount.grid(column=3, row=3)
    create.mainloop()

def login(event):
    global logpassEntry, loguserEntry
    start.destroy()
    logincad = Tk()
    logincad.geometry('250x80')
    loguserText = Label(logincad, text='First Name: ')
    loguserText.grid(column=0, row=0)
    loguserEntry = Entry(logincad)
    loguserEntry.grid(column=1, row=0)
    logpassText = Label(logincad, text='Password: ')
    logpassText.grid(column=0, row=1)
    logpassEntry = Entry(logincad)
    logpassEntry.grid(column=1, row=1)
    loginbutton = Button(logincad, text='Login')
    loginbutton.bind('<Button-1>', checklogin)
    loginbutton.grid(column=1, row=2)
    logincad.mainloop()

def regButton(event):
    global Application, DOB, Age, FirstName,LastName, firstEntry, lastEntry, AgeEntry, DOBEntry, passEntry, a
    FirstName = firstEntry.get()
    LastName = lastEntry.get()
    Age = AgeEntry.get()
    DOB = DOBEntry.get()
    password = passEntry.get()
    Application = {"First Name": FirstName, "Last Name": LastName, "Password": password, "Age": Age, "DOB": DOB}
    if len(FirstName) < 1:
        Message('Error', 'Name to short')
    elif len(LastName) < 1:
        Message('Error', 'Last Name to short')
    elif int(Age) < 16:
        Message('Error', 'Age has to be greater then 16')
    else:
        Message('Registered', 'Account Created')
        insert = pendingApplications.insert_one(Application)
        exit()


def startMenu():
    global start
    start = Tk()
    start.geometry('5x30')
    createacc = Button(start, text='Register')
    createacc.bind('<Button-1>', createChar)
    createacc.grid(column=0, row=0)
    loginacc = Button(start, text='Login')
    loginacc.bind('<Button-1>', login)
    loginacc.grid(column=1, row=0)
    start.mainloop()


startMenu()