FXPy TextField question

robin and jim robinjim at earthlink.net
Tue Jun 4 20:13:35 EDT 2002


Hello,

I installed the latest MS Windows binary distribution of the FOX GUI library
(FXPy-1.0.5) for Python 2.2, but I am unable to access the data entered in a
FXTextField widgit.

Here is what I have tried.  Any suggestions would be appreciated.

# begin -------------------------------
import sys
from FXPy.fox import *

class Test_Window(FXMainWindow):

    def __init__(self, app):
        FXMainWindow.__init__(self, app, "Text Field Test", opts=DECOR_ALL,
x=20, y=20, w=200, h=150)
        FXMAPFUNC(self, SEL_COMMAND, FXDataTarget.ID_VALUE,
Test_Window.onCmd_Handle_Entry)

        # Initialize the data targets for this example
        self.stringTarget   = FXDataTarget("FOX")

        matrix = FXMatrix(self, 1,
MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y)

        FXTextField(matrix, 10, self.stringTarget, FXDataTarget.ID_VALUE,

LAYOUT_CENTER_Y|LAYOUT_CENTER_X|FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_ROW)

    def create(self):
        # Create the windows
        FXMainWindow.create(self)

        # Show the main window centered on the screen
        self.show(PLACEMENT_SCREEN)


    def onCmd_Handle_Entry(self, sender, sel, ptr):
       # Handle completed data entry message for the starting date-time
field
       print 'handled text field message'

def run():
    # Make application
    application = FXApp("DataTarget", "FoxTest")

    # Open display
    application.init(sys.argv)

    # Create the main window
    window = Test_Window(application)

    # Create application
    application.create()

    # Run
    return application.run()

if __name__ == "__main__":
    run()
# end -------------------------------






More information about the Python-list mailing list