ich habe mich seit dem WE mit Python und Tkinter auseinander gesetzt mit einem Projekt, was aus einer SQLite DB meine daten auslesen soll und dann eine Verbindung zu dem jeweiligen PC herstellen soll
Code: Alles auswählen
# -*- coding: utf-8 -*-
from Tkinter import *
import ttk
import tkMessageBox
import Tkinter as tk
import sqlite3 as lite
from PIL import ImageTk, Image
def start(adresse,passwort):
print(adresse)
print(passwort)
#Start AnyDesk
def verbindungen(tab,pc):
with con:
cur = con.cursor()
cur.execute("hier ist mein SQL State")
rows = cur.fetchall()
Grid.rowconfigure(tab, 1, weight=1)
Grid.columnconfigure(tab, 0, weight=1)
frame=Frame(tab)
frame.grid(row=0, column=0, sticky=N+S+E+W)
rowing = 0
columning = 0
for row in rows:
Grid.rowconfigure(frame, rowing, weight=1)
adress_id = row[0]
adresse = row[1]
passwort = row[2]
hotel_name = row[4]
hotel_fix = str(row[5])
server = row[6]
if columning == 5:
rowing += 1
columning = 0
Grid.columnconfigure(frame, columning, weight=1)
group = LabelFrame(frame, text=hotel_name, padx=5, pady=5)
group.grid(row=rowing, column=columning)
image = Image.open("res/img/hotel/"+hotel_fix+".jpg")
photo = ImageTk.PhotoImage(image)
label = Label(group, image=photo)
label.image = photo # keep a reference!
label.grid(row=rowing, column=columning)
if server == 1:
server_img = PhotoImage(file ="res/img/server.gif")
server = Label(group, image = server_img)
server.image = server_img
server.grid(row=rowing, column=columning, sticky=NE)
play_button = Button(group, text="play",command=lambda: start(adresse,passwort))
play_img = PhotoImage(file="res/img/play.gif")
play_button.config(image=play_img)
play_button.image = play_img
play_button.grid(row=rowing, column=columning, sticky=NW)
columning += 1
cur.close()
main = Tk()
main.geometry('1024x768')
con = lite.connect('res/database.db')
# gives weight to the cells in the grid
rows = 0
while rows < 50:
main.rowconfigure(rows, weight=1)
main.columnconfigure(rows, weight=1)
rows += 1
# Defines and places the notebook widget
nb = ttk.Notebook(main)
nb.grid(row=1, column=0, columnspan=50, rowspan=49, sticky='NESW')
# Adds tab 1 of the notebook
tab1 = ttk.Frame(nb)
lab = 'Frontoffice'
nb.add(tab1, text=lab)
verbindungen(tab1,lab)
main.mainloop()
wo liegt da mein Fehler?
vielen Dank schon mal für die Hilfe