Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flet python does not work #3361

Closed
tarovq opened this issue May 26, 2024 · 0 comments
Closed

flet python does not work #3361

tarovq opened this issue May 26, 2024 · 0 comments

Comments

@tarovq
Copy link

tarovq commented May 26, 2024

import flet as ft
import sqlite3

def fetch_data(table_name):
connection = sqlite3.connect('post_office.db')
cursor = connection.cursor()
cursor.execute(f"SELECT * FROM {table_name}")
rows = cursor.fetchall()
cursor.execute(f"PRAGMA table_info({table_name})")
columns_info = cursor.fetchall()
column_names = [col[1] for col in columns_info]
connection.close()
return column_names, rows

def add_customer(initials, adress, phone, email):
connection = sqlite3.connect('post_office.db')
cursor = connection.cursor()
cursor.execute("INSERT INTO Customers (Initials, Adress, Phone, Email) VALUES (?, ?, ?, ?)",
(initials, adress, phone, email))
connection.commit()
connection.close()

def main(page: ft.Page):
page.title = "Post Office Management System"
page.bgcolor = '#ebebeb'
page.window_maximized = True

initials = ft.TextField(label="Initials")
adress = ft.TextField(label="Adress")
phone = ft.TextField(label="Phone")
email = ft.TextField(label="Email")
add_customer_button = ft.Button(text="Add Customer", on_click=lambda e: add_customer(
    initials.value, adress.value, phone.value, email.value))

page.add(initials, adress, phone, email, add_customer_button)

page.run()

ft.app(target=main)
when I run the code, nothing happens and so with any code where there is import flet as ft

@flet-dev flet-dev locked and limited conversation to collaborators May 27, 2024
@ndonkoHenri ndonkoHenri converted this issue into discussion #3362 May 27, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant