Beispiel #1
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent, bg='azure')
        self.DBfile = '.\\newsChecker.mdb'
        self.conn = pypyodbc.connect(
            r'Driver={Microsoft Access Driver (*.mdb)};DBQ=' + self.DBfile)
        self.myCursor = self.conn.cursor()
        self.controller = controller
        self.labelHeader = tk.Label(self,
                                    text="Login Web Scraper",
                                    bg='azure',
                                    font=controller.title_font)
        self.labelHeader.grid(column=0, row=0, pady=5)

        #LABELS && ENTRY FIELDS && TEXTFIELDS
        self.emailLabel = tk.Label(
            self,
            text="Please enter your email adress",
            bg='azure',
            font='Helvetica 10 bold',
        ).grid(column=0, row=1, pady=20)
        self.emailEntry = tk.Entry(self, width=50)
        self.emailEntry.grid(column=1, row=1, pady=20)

        self.passwordLabel = tk.Label(
            self,
            text="Please enter your password",
            bg='azure',
            font='Helvetica 10 bold',
        ).grid(column=0, row=2, pady=10)
        self.passwordEntry = tk.Entry(self, show="*", width=50)
        self.passwordEntry.grid(column=1, row=2, pady=10)

        self.txt = tk.Text(self, width=40, height=10, pady=10)
        self.txt.grid(column=1, row=3, pady=5)

        self.button1 = tk.Button(
            self,
            text="Login",
            width='40',
            bg="royal blue",
            fg='white',
            font='Helvetica 10 bold',
            command=self.login)  # Login DevMode for no login
        self.button1.grid(column=1, row=4, pady=15)
        self.button2 = tk.Button(
            self,
            text="Register new account ",
            width='40',
            fg='white',
            bg="lawn green",
            font='Helvetica 10 bold',
            command=lambda: controller.show_frame("RegisterPage"))
        self.button2.grid(column=1, row=5, pady=10)
Beispiel #2
0
 def addToDB(self):
     self.txt.delete(1.0, END)
     DBfile = '.\\hotel.mdb'
     conn = pypyodbc.connect(
         r'Driver={Microsoft Access Driver (*.mdb)};DBQ=' + DBfile)
     myCursor = conn.cursor()
     SQL_insert = "insert into guest(gname,gender,roomtype,price) values ('" + self.entryName.get(
     ) + "','" + self.gender.get() + "','" + self.roomVariable.get(
     ) + "','" + self.priceEntry.get() + "')"
     myCursor.execute(SQL_insert)
     myCursor.commit()
     self.txt.insert(END, "Saved to Database")
     self.txt.insert(END, "\n")
Beispiel #3
0
 def showDB(self):
     self.txt.delete(1.0, END)
     DBfile = '.\\hotel.mdb'
     conn = pypyodbc.connect(
         r'Driver={Microsoft Access Driver (*.mdb)};DBQ=' + DBfile)
     myCursor = conn.cursor()
     SQL = "SELECT * FROM guest"
     guests = myCursor.execute(SQL)
     self.txt.insert(END, "Hotelguests: ")
     for guest in guests:
         self.txt.insert(
             END, 'Name: ' + guest[0] + " is gender: " + guest[1] +
             " stays at room: " + guest[2] + " for the price: " + guest[3] +
             "Euros")
Beispiel #4
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.DBfile = '.\\newsChecker.mdb'
        self.conn = pypyodbc.connect(
            r'Driver={Microsoft Access Driver (*.mdb)};DBQ=' + self.DBfile)
        self.myCursor = self.conn.cursor()
        self.controller = controller

        self.label = tk.Label(self,
                              text="This is page 2",
                              font=controller.title_font)

        self.linkEntry = tk.Entry(self, width=50)
        self.linkEntry.pack()

        self.outputText = tk.Text(self, width=20, height=10)
        self.outputText.pack()

        self.getDataButtton = tk.Button(self,
                                        width=30,
                                        fg="white",
                                        bg="black",
                                        command=self.getData).pack()

        self.label.pack(side="top", fill="x", pady=10)

        self.tableNameEntry = tk.Entry(self, width=50)
        self.tableNameEntry.pack()

        self.createTableBtn = tk.Button(self,
                                        text="Create New Table",
                                        command=self.createNewDatabaseTable)
        self.createTableBtn.pack()

        self.getTableBtn = tk.Button(self,
                                     text="Create New Table",
                                     command=self.getTableNames)
        self.getTableBtn.pack()

        self.button = tk.Button(
            self,
            text="Go to the start page",
            command=lambda: controller.show_frame("StartPage"))

        self.button.pack()
Beispiel #5
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent, bg="azure")
        self.DBfile = '.\\NewsChecker.mdb'
        self.conn = pypyodbc.connect(
            r'Driver={Microsoft Access Driver (*.mdb)};DBQ=' + self.DBfile)
        self.myCursor = self.conn.cursor()
        self.controller = controller
        self.label = tk.Label(self,
                              text="Web Scrape Register",
                              bg="azure",
                              font=controller.title_font)
        self.label.grid(row=0, column=0)

        self.labelName = tk.Label(self,
                                  text="Please enter your Name",
                                  bg="azure",
                                  font='Helvetica 10 bold').grid(row=1,
                                                                 column=0)
        self.entryName = tk.Entry(self, width="50")
        self.entryName.grid(row=1, column=1, pady=20, padx=10)

        self.labelGender = tk.Label(self,
                                    text="Which gender are you? ",
                                    bg="azure",
                                    font='Helvetica 10 bold').grid(row=2,
                                                                   column=0,
                                                                   pady=10,
                                                                   padx=10)
        self.mOF = tk.StringVar()
        self.mOF.set("Male")
        self.option = tk.OptionMenu(self, self.mOF, "Male", "Female", "Divers")
        self.option.grid(row=2, column=1, pady=10, padx=10)

        self.labelStudent = tk.Label(self,
                                     text="Student status: ",
                                     bg="azure",
                                     font='Helvetica 10 bold').grid(row=3,
                                                                    column=0,
                                                                    pady=10,
                                                                    padx=10)
        self.var = tk.StringVar()
        self.var.set("0")
        self.checkButton = tk.Checkbutton(self,
                                          text="Are you a student",
                                          variable=self.var,
                                          onvalue=-1,
                                          offvalue=0,
                                          bg="azure")
        self.checkButton.grid(row=3, column=1, pady=10, padx=10)

        self.labelEmail = tk.Label(self,
                                   text="Please enter your email adress",
                                   bg="azure",
                                   font='Helvetica 10 bold').grid(row=4,
                                                                  column=0,
                                                                  pady=10,
                                                                  padx=10)
        self.entryEmail = tk.Entry(self, width="50")
        self.entryEmail.grid(row=4, column=1)

        self.labelPassword = tk.Label(self,
                                      text="Password (min 6. charackters)",
                                      bg="azure",
                                      font='Helvetica 10 bold').grid(row=5,
                                                                     column=0,
                                                                     pady=10,
                                                                     padx=10)
        self.entryPassword = tk.Entry(self, show="*", width="50")
        self.entryPassword.grid(row=5, column=1, pady=10, padx=10)

        self.labelPassword1 = tk.Label(self,
                                       text="Please repeat your Password",
                                       bg="azure",
                                       font='Helvetica 10 bold').grid(row=6,
                                                                      column=0,
                                                                      pady=10,
                                                                      padx=10)
        self.entryPassword1 = tk.Entry(self, show="*", width="50")
        self.entryPassword1.grid(row=6, column=1, pady=10, padx=10)

        self.labelText = tk.Label(self,
                                  text="Please take care: ",
                                  bg="azure",
                                  font='Helvetica 10 bold').grid(row=7,
                                                                 column=0,
                                                                 pady=10,
                                                                 padx=10)
        self.txt = tk.Text(self, width="35", height="10")
        self.txt.grid(row=7, column=1, padx=10, pady=10)

        button = tk.Button(self,
                           text="Register",
                           fg="white",
                           bg="lawn green",
                           width='40',
                           font='Helvetica 10 bold',
                           command=self.registerUser).grid(row=8,
                                                           column=1,
                                                           pady=10,
                                                           padx=10)

        button = tk.Button(self,
                           text="Go to the start page",
                           fg="white",
                           bg="royal blue",
                           width='40',
                           font='Helvetica 10 bold',
                           command=lambda: controller.show_frame("StartPage"))
        button.grid(row=9, column=1, pady=10, padx=10)
Beispiel #6
0
from bs4 import BeautifulSoup
import requests
from requests import get
from lib.sitepackages import pypyodbc
import soupsieve

DBfile = '.\\NewsChecker.mdb'
conn = pypyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb)};DBQ=' +
                        DBfile)

myCursor = conn.cursor()
#SQL = "CREATE TABLE newsChecker"  #IF NOT EXISTS // MS ACCESS DONT SUPPORT CONTROL FLOW :(
#row = myCursor.execute(SQL)
#myCursor.commit()

url = 'https://www.learnlaravel.me/getting-started/'

response = get(url)

html_soup = BeautifulSoup(response.text, 'html.parser')

content = html_soup.find('div', "entry-content")

listelements = content.findAll('li')

price = content.li
link = price

contentList = []

for i in listelements:
Beispiel #7
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent, bg="azure")
        self.DBfile = '.\\newsChecker.mdb'
        self.conn = pypyodbc.connect(
            r'Driver={Microsoft Access Driver (*.mdb)};DBQ=' + self.DBfile)
        self.myCursor = self.conn.cursor()
        self.controller = controller

        self.label = tk.Label(self,
                              text="Webscrape",
                              font=controller.title_font,
                              bg='azure').grid(row=0, column=0)

        self.linkLabel = tk.Label(self,
                                  text="ScrapeLink :",
                                  bg='azure',
                                  font='Helvetica 10 bold').grid(row=1,
                                                                 column=0)
        self.linkEntry = tk.Entry(self, width=50)
        self.linkEntry.grid(row=1, column=1)

        self.labelDatabase = tk.Label(self,
                                      text="Create and Save Table",
                                      bg='azure',
                                      font='Helvetica 10 bold').grid(row=2,
                                                                     column=0)
        self.tableNameEntry = tk.Entry(self, width=50)
        self.tableNameEntry.grid(row=2, column=1)

        self.linkTextLabel = tk.Label(self,
                                      text="Choose one Link: ",
                                      bg='azure',
                                      font='Helvetica 10 bold').grid(row=3,
                                                                     column=0)
        self.textLinks = tk.Text(self, width=50, height=10)
        self.textLinks.grid(row=4, column=0)

        self.textLinks.insert(tk.END,
                              'https://www.learnlaravel.me/getting-started/')
        self.textLinks.insert(tk.END, '\n')
        self.textLinks.insert(
            tk.END,
            'https://www.learnlaravel.me/validation-and-business-logic/')
        self.textLinks.insert(tk.END, '\n')
        self.textLinks.insert(
            tk.END, 'https://www.learnlaravel.me/templating-and-views/')
        self.textLinks.insert(tk.END, '\n')
        self.textLinks.insert(
            tk.END, 'https://www.learnlaravel.me/integrating-components/')
        self.textLinks.insert(tk.END, '\n')
        self.textLinks.insert(tk.END, 'https://www.learnlaravel.me/security/')
        self.textLinks.insert(tk.END, '\n')

        self.outputText = tk.Text(self, width=40, height=10)
        self.outputText.grid(row=4, column=1)

        self.getDataButtton = tk.Button(self,
                                        text="Save to existing Table",
                                        command=self.saveData,
                                        fg="white",
                                        bg="gold",
                                        width='40',
                                        font='Helvetica 10 bold').grid(
                                            row=5, column=1, pady=10, padx=10)

        self.createTableBtn = tk.Button(self,
                                        text="Create New Table",
                                        command=self.createNewDatabaseTable,
                                        fg="white",
                                        bg="dark turquoise",
                                        width='40',
                                        font='Helvetica 10 bold')
        self.createTableBtn.grid(row=6, column=1, pady=10, padx=10)

        self.getTableBtn1 = tk.Button(self,
                                      text="Get All Existing Table Names",
                                      command=self.getAllTableNames,
                                      fg="white",
                                      bg="brown1",
                                      width='40',
                                      font='Helvetica 10 bold')
        self.getTableBtn1.grid(row=7, column=1, pady=10, padx=10)

        self.getTableBtn = tk.Button(self,
                                     text="Save new Tablename",
                                     command=self.saveTableName,
                                     fg="white",
                                     bg="deep pink",
                                     width='40',
                                     font='Helvetica 10 bold')
        self.getTableBtn.grid(row=8, column=1, pady=10, padx=10)

        self.saveNewBtn = tk.Button(self,
                                    text="New Table & Save Data",
                                    command=self.saveDataToNewTable,
                                    fg="white",
                                    bg="lawn green",
                                    width='40',
                                    font='Helvetica 10 bold')
        self.saveNewBtn.grid(row=9, column=1, pady=10, padx=10)

        self.button = tk.Button(
            self,
            text="Go to the start page",
            command=lambda: controller.show_frame("StartPage"),
            fg="white",
            bg="royal blue",
            width='40',
            font='Helvetica 10 bold')

        self.button.grid(row=10, column=1, pady=10, padx=10)