1 / 14

CS-260

CS-260. Event Driven Programming Dick Steflik. What is it?. Program execution is determined by user or sensor generated events rather than the old linear (begining to end) execution of command line programs. Execution is non-linear. Embedded Systems.

xiang
Télécharger la présentation

CS-260

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS-260 Event Driven Programming Dick Steflik

  2. What is it? • Program execution is determined by user or sensor generated events rather than the old linear (begining to end) execution of command line programs. • Execution is non-linear

  3. Embedded Systems • Interrupts – these are usually sensor generated asynchronous real-world events. • Usually handled by an ISS (Interrupt Servicing Subroutine) that gains control via a hardware controlled vector (automatic hardware branch). • Ex. A microcontroller based humidifier that has a low water interrupt that automatically puts the device into a non-damaging state when it runs out of water and displays a low water message.

  4. Event Handling • The IBM Series 1 (circa 1980s) process control computer was one of the first event driven computers, it responded to external sensor generated events and was used to control industrial processes. • Programmed via EDL (Event Driven Language). • For each possible event a handler was provided, a typical program would initialize the environment then enter a do forever loop. When an event occurred, program control would transfer from the loop to the appropriate handler, execute the handler then return to the loop.

  5. GUI Event Processing • With the advent of the personal computer and the modern day Graphical User Interface the model used for Event Processing in process control applications was extended to the GUI. • Initialize the environmentregister the event generatorsloop forever (wait for an event) • when an even occurs, put it into the event queue • the dispatcher will examine the next event in the queue and invoke the correct handler

  6. Initializing the Environment • Mask off all events (don’t allow events) • Register all of the widgets that create events • what they are, where they are, names • Register the event handlers • bind the various events to their handlers • Unmask the events (allow them to happen.

  7. Event Queues • most systems enqueue events before dispatching • a queue may be a simple fifo but more likely a priority queue, that way some events can be dispatched before others

  8. GUI Events • Keyboard Events • Mouse Events • Screen Events (touch screens) • Pen Events

  9. Cross Platform GUI Toolkits • Tcl/Tk – The Tk GUI toolkit • Tkinter: python wrappers for Tk; open source • GTK+ (Gimp Toolkit) • PyGTK : Python wrappers for the GTK+; open source • wxWidgets • wxPython: Python bindings for wxWidgets; open source • Qt • PyQt: Python bindings for Qt; PyQt is a licensed product (as is Qt)

  10. Tkinter : Tk Interface • a Python binding to the Tk GUI toolkit • de-facto GUI standard for Python • written by Fredrik Lundh • Python wrapper around a Tcl interpreter embedded in the Python interpretor; this lets you mix Python and Tcl in the same program. • “themed Tk” - Tk widgets can be themed to look like the hosting OS.

  11. Toolkit Relationships

  12. Previous Slide • The previous slide shows the relationships on UNIX and LINUX systems where the toolkits are based on X11, remember X11 is a client-server display system where the app is an X-client and makes calls to xlib to send commands to an display things and uses an x-server to display them. This is very different than the way it is done on Windows

  13. X11 Architecture Example deployment of X server: the X server receives input from a local keyboard and mouse and displays to a screen. A web browser and a terminal emulator run on the user's workstation and a software update application runs on a remote computer but is controlled and monitored from the user's machine

More Related