Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#!/usr/bin/python import gtk import MySQLdb as mdb import sys def send_press(widget): try: con = mdb.connect('localhost', 'root', 'root', 'test'); cur = con.cursor() cur.execute("INSERT INTO table1(name) VALUES('" + entry.get_text() + "')") cur.execute("SELECT * FROM table1") rows = cur.fetchall() for row in rows: print row except mdb.Error, e: print "Error %d: %s" % (e.args[0],e.args[1]) sys.exit(1) finally: if con: con.close() win=gtk.Window() win.connect('destroy', lambda w: gtk.main_quit()) box = gtk.VBox() win.add(box) entry=gtk.Entry() box.pack_start(entry) send=gtk.Button("SEND") send.connect("clicked", send_press) box.pack_start(send) win.show_all() gtk.main()
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)