[anjuta-list] How to define the entry?
- From: "????????" <736036594 qq com>
- To: "anjuta-list" <anjuta-list gnome org>
- Subject: [anjuta-list] How to define the entry?
- Date: Fri, 24 May 2013 22:32:39 +0800
Dear Sir:
I want to write a GUI with python. There has existed a entry.
The following is my code:
----------------------------------------------------------------------------------------------
from gi.repository import Gtk, GdkPixbuf, Gdk
import os, sys, serial
ser =serial.Serial('/dev/ttyUSB0',9600,parity=serial.PARITY_ODD)
class GUI:
def __init__(self):
self.builder = Gtk.Builder()
self.builder.add_from_file(UI_FILE)
self.builder.connect_signals(self)
window = self.builder.get_object('window')
window.show_all()
def on_button_clicked (self, button):
text =entry.get_text() #I want to get the text of entry and sent it to serial port
ser.write(text)
def destroy(window, self):
Gtk.main_quit()
def main():
app = GUI()
Gtk.main()
if __name__ == "__main__":
sys.exit(main())
-------------------------------------------------------------------------------------------
But when I execute it, it returns this error:
NameError: global name 'entry' is not defined.
Could your tell me how to define a entry and Where I should put the statement on?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]