GTK glade SQLite Problem
- From: Sangram Kakade <sangramrajekakade gmail com>
- To: gtk-app-devel-list gnome org
- Subject: GTK glade SQLite Problem
- Date: Mon, 24 Oct 2016 11:04:59 +0530
Hello Everyone,
I am Newbie in Python and i want some help
I already created DB and in glade two Text Entry Box and one button
and i want when i put some value in text entry it must be stored in db
here is my code:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import sqlite3
import sys
class Handler:
def insert_sqlite():
connection = sqlite3.connect('mydatabase')
cursor = connection.cursor()
sql ="INSERT INTO person_info (name,lastnm) VALUES ('%s','%s')"
cursor.execute(sql)
data = cursor.fetchall()
for d in data:
print(d)
connection.commit()
connection.close
def display_details():
connection = sqlite3.connect('mydatabase')
cursor = connection.cursor()
sql = "SELECT * FROM person_info "
cursor.execute(sql)
data = cursor.fetchall()
for d in data:
print(d)
connection.commit()
connection.close
builder = Gtk.Builder()
builder.add_from_file("cool.glade")
builder.connect_signals(Handler())
window = builder.get_object("window1")
window.show_all()
Gtk.main()
I also set signal in glade
clicked signal( insert_sqlite)
on save button
but data is not save in Database
Please Help me guys
--
Thanks & Regards,
Sangram Kakade <http://www.sangramkakade.com>
Python/Django Developer
Mob.No. 9975159162 / 8796535503
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]