Added patched PyGUI folder - needs work

This commit is contained in:
Skyler Lehmkuhl 2012-01-04 14:15:34 -05:00
parent 8190f8010b
commit 6e0fa46ea2
774 changed files with 58929 additions and 0 deletions

874
PyGUI-2.5.3/CHANGES.txt Normal file
View File

@ -0,0 +1,874 @@
2.5.3
-----
Enhancements:
- Cocoa: Reading and writing the clipboard is now implemented.
Bug fixes:
- Cocoa: Prevented spurious changes of input focus due to clicking
on a view.
- Cocoa: Put in fudge factor to correct text positioning when using
Courier New.
- Cocoa: Prevented burning 100% CPU time during a modal event loop.
- Win32: Was unable to save a document over an existing file.
- Win32: Reading an empty clipboard did not work.
2.5.2
-----
Bug fixes:
- Win32: When run from a command shell, application would exit when
focus switched to another process.
2.5.1
-----
Bug fixes:
- The file distutils_extensions.py was missing from the distribution.
2.5
---
Modifications:
- The old autoloading system has been removed and replaced with
something that will hopefully be friendlier towards py2exe and
py2app. There have been some minor changes to the API as a
result:
- Any class or function not explicitly documented as being in
a submodule *MUST* now be imported directly from the GUI
package, not from the submodule that it resides in.
- Importing is mandatory. You must do either 'from GUI import
Foo' or 'import GUI.Foo' for every class Foo that you use,
not just 'import GUI' and then refer to GUI.Foo.
- Some classes and functions that were previously available
directly from the GUI package are now in submodules and must
be imported from there:
- All the alert functions are now in GUI.Alerts
- All the file dialog functions are now in GUI.FileDialogs
- FileType, FileRef and DirRef are now in GUI.Files
- DefaultButton and CancelButton are now in GUI.StdButtons
Note that for best results, PyGUI should be installed using
'python setup.py install' before using it with py2exe or py2app.
These tools will not be able to automatically find submodules of
a PyGUI that is used directly from the source directory.
New features:
- Improved facilities for customising menus when building a menu bar
with StdMenus.basic_menus().
- Functions for creating PyGUI Images from PIL images and numpy arrays.
- Resource cacheing (see Resources.get_resource()).
- ListButton control providing a pop-up or pull-down menu of choices.
- GridView - a user-defined view consisting of a regular grid of cells.
- PaletteView - a GridView specialised for implementing tool palettes.
Enhancements:
- Added get_default_save_directory() and get_default_save_filename()
methods to Document, and get_default_open_directory() to Application.
- Setting both 'content_size' and 'scrolling' using keyword args to
the ScrollableView constructor now works as expected.
- Padding may now be specified around the contents of a Row, Column
or Grid.
- ScrollableView now has a background_color property specifying a color
to automatically fill areas outside the extent.
Bug fixes:
- Cocoa: Setting the border property of a TextField did not work.
- Cocoa: Setting the content_size of a ScrollableView did not work.
- Cocoa: Current point was not advanced correctly when drawing text.
- Cocoa: Worked around a memory leak in PyObjC 2.3 affecting
Canvas.lines() and related methods.
- Gtk: Canvas.gsave()/grestore() did not work properly.
- Gtk: 'style' argument to Window constructor was not handled properly.
- Gtk, Windows: The mechanism for quitting the application when there are
no visible windows left has been made more reliable.
- Windows: Application was not initially brought to the foreground when
launched.
- Windows: Initial filename argument to request_new_file did not work.
- Setting the save_file_type property of an Application did not work.
- Relative filenames passed as command line arguments caused problems.
- Setting content_width and content_height properties did not work properly.
- NumPy arrays did not work as parameters to Canvas methods taking
sequences of points.
2.4.1
-----
Enhancements:
- On MacOSX, the unmodified character corresponding to a key event
with Option pressed is now put into the 'key' attribute. On all
platforms, 'key' now mirrors 'char' if there is no other particular
value for it to have.
- Key events now have a 'unichars' attribute on all platforms.
- Return key on main keyboard now sets 'key' to 'return' instead of
an empty string.
2.4
---
Enhancements:
- Classifiers for PyPi upload added to setup.py. [Vernon Cole]
- Automatically detect Python 3 and convert syntax while installing.
[Vernon Cole]
- Code modifications for Python 3 compatibility. All tests now pass
using Python 3.1 on MacOSX and Windows.
Bug fixes:
- Win32: Invoking the last command in the last menu in the menu bar
with the mouse did not work.
- Win32: ScrollableView re-implemented without using the MFC View class.
This eliminates several problems that were plaguing the old implementation.
- Win32: Font sizes were too small when using some pywin32 builds.
2.3.3
-----
Bug fixes:
- Previous fix for Pixmap coordinates in Cocoa did not work on
some MacOSX versions.
2.3.2
-----
Bug fixes:
- Canvas docs incorrectly stated that the current path was cleared after
filling or stroking.
- Cocoa: Coordinate system for drawing in a Pixmap was upside down.
2.3.1
-----
Bug fixes:
- Win32: Fixed a bug in the previous ScrollableView fix.
- Win32: If a modal dialog was dismissed by pressing the Enter key,
the subsequent key-up event could spuriously trigger a button
in another window.
2.3
---
Enhancements:
- GLView selects modelview matrix and sets it to identity before
calling render().
- Added init_projection() method to GLView, called from default
implementation of viewport_changed() with projection matrix
selected and set to identity.
- Texture.gl_id() method returns the texture ID for the current
context without binding it.
- Texture.gl_tex_image_2D() method loads texture data from an Image.
- Updated to work on Snow Leopard with PyObjC 2.3.
Bug fixes:
- Filename case error in setup.py causing cursor resources not to
be installed.
- Crash on closing a window containing a GLView due to attempting
to call glViewport for an invalid GL context.
- Fixed some problems with Images and Pixmaps in Cocoa.
- Win32: Fixed crash concerning ScrollableView with pywin32 build
213 and later.
2.2
---
New features:
- TextEditor component with scroll bars and uniform tab stops
for editing large amounts of text.
- Row, Column and Grid layout classes.
- Printing support.
Enhancements:
- Component add() and remove() methods now accept a sequence of
items as well as a single item.
- All Controls now uniformly have a 'value' property.
- RadioGroup add() and remove() methods replaced with add_item(),
remove_item(), add_items() and remove_items() to avoid name clash
when mixing a RadioGroup with a Component.
Bug fixes:
- Unicode strings as menu item titles did not work properly.
- Win32: Misnamed function in GDI+ interface (GdipAddPathLine2).
2.1.1
-----
Enhancements:
- CheckBox now has a 'mixed' property that can be changed
after creation.
Bug fixes:
- Cocoa: Text fields had the wrong border style.
- Gtk: Window show/hide was broken in 2.1.
- Windows: File dialogs did not set initial directory properly.
2.1
---
Enhancements:
- All menus can now be removed by assigning an empty list to
the menus property of the application.
- Cocoa: Hide, Hide Others and Show All now enabled in the
application menu.
- Win32: Added more standard cursors.
Bug fixes:
- Gtk: Removed spurious 'self' in TextField.set_selection().
- Win32: Can run PyGUI apps using pythonw now.
- Win32: Fixed coordinate transformation problems in ScrollableView.
2.0.7
-----
Bug fixes:
- Cocoa: Canvas.lines and Canvas.poly did not work.
2.0.6
-----
Enhancements:
- Cocoa: Redesigned handling of standard editing commands for
builtin components to make them overridable and to cooperate
better with custom components.
2.0.5
-----
Bug fixes:
- Win32: Removed experimental mouse leave event handling that
was causing problems on some systems.
- Win32: Trying native backend before gtk in case gtk is
installed.
- Cocoa: Custom view objects could not be targeted.
- Cocoa: Canvas.rect() did not work.
- Gtk: Mouse move events were being reported as mouse drags.
Enhancements:
- Win32: hand and fist cursors improved.
- Added selection_forecolor and selection_backcolor to the
StdColors submodule.
API changes:
- Removed mouse_enter and mouse_leave events from the official
API for the time being, since they are not easy to implement
consistently across all platforms.
2.0.4
-----
Bug fixes:
- BlobEdit demo: Reduced flickering on Windows.
- Win32: Full menu list of a window sometimes not updated
properly, leading to '_all_menus' attribute error.
- Win32: Disabled customization of Control colour for now,
since it doesn't seem to work properly on XP.
- Win32: Tab key with no control focused did not tab to the
first control.
- Win32: Return/Enter now activates a focused control as
well as space.
- Win32: Error in printed instructions for test 29.
- Win32: Changed the way window background colour is handled
to prevent flickering when resizing.
- Win32: Fixed problem with 'pitch_and_family' when creating
a font.
- Canvas was missing fill_frame_rect() on some platforms.
- Canvas.frame_rect() was not starting a new path on some
platforms.
- Pressing Tab in a window with no subcomponents caused crash.
2.0.3
-----
Bug fixes:
- BlobEdit demo:
- clear background before drawing.
- Win32 - attribute error on startup.
2.0.2
-----
Bug fixes:
- Fixed problem on Windows resulting in "This module should
not be imported" error.
- Cocoa: Canvas was using fillcolor instead of textcolor
for drawing text.
2.0.1
-----
Bug fixes:
- Fixed problems in setup.py affecting installation on
Linux and Windows.
2.0
---
API changes:
- The 'extent' property of ScrollableView is now just a size
rather than a rectangle.
- By default, containers now re-layout their contents when their
size changes for any reason, not just when the user resizes the
window. There is a new property auto_layout controlling this
behaviour. Conversely, the default behaviour of the resize()
method is now *not* to re-layout the contents, with an option
to do so.
New features:
- Major additions made to the Canvas class. Full set of Postscript
style path construction operators now implemented on all platforms,
and a wide variety of new high-level functions have been added.
- Added a keeps_document_open attribute to Window to allow for
windows that do not keep their associated document open.
- Added 'fullscreen' window style.
- Added 'invisible' cursor to StdCursors.
- Added delta attribute to mouse_move and mouse_drag events
(currently MacOSX only).
- Added leading, cap_height, x_height properties to Font.
- Added enter-key and escape-key actions to TextField.
Enhancements:
- Mouse and keyboard event handling can now be overridden for
all component classes, not just user-defined views.
- Cocoa: Change dot is set in window title bar when the
window's associated document needs saving.
- When saving a document, data is written to a temporary file
which is then renamed, to avoid destroying the original file
if the write fails.
- Container.shrink_wrap() will figure out a reasonable padding if
you don't specify one.
- Setup script only installs relevant backend for platform.
Modifications:
- Renamed 'tabbable' property to 'tab_stop'. Provided a mechanism
for the user to express a preferences as to whether non-textfield
controls are tabbed into, defaulting to platform conventions.
- Canvas now has separate pen, fill and text colour properties. The
'forecolor' property is write-only and sets all three to the same
colour. Erasing operations replace image with background colour,
other operations blend.
Bug fixes:
- Cocoa: Default and cancel buttons in dialogs were being
activated twice when Enter or Escape pressed.
- Crash occurred when closing a Window that was not attached
to a Document.
- Exceptions.InternalError had nonexistent base class.
1.7.3
-----
Enhancements:
- Cocoa: Tasks continue to run while menus and controls are
being manipulated.
- Cocoa: Using more reliable method of handling command line
arguments in non-py2app environments. Should address
problems with IDLE.
1.7.2
-----
New features:
- New events and event handling facilities:
- Support for multiple mouse buttons. The mouse_down and
mouse_up events now have a 'button' attribute.
- Views can define methods to handle mouse_drag and mouse_up
events as an alternative to using track_mouse().
- New mouse events: mouse_enter, mouse_leave.
See "Mouse Events" under the "Event Handling" topic for a
discussion of the new event features.
- Improved alignment of different control types when they
are laid out by place_row().
- New file dialog functions for requesting multiple files
and requesting old and new directories.
- New Application properties: open_file_types, save_file_type,
file_type
Enhancements:
- Changed Gtk implementation of file dialogs to use newer
widgets, and implemented file type filtering.
- Tidied up the APIs of FileRef and DirRef, and made them
immutable.
- Cocoa: Slider in discrete mode now only calls action when
the value changes, instead of whenever the mouse is dragged.
- Cocoa: Undo and Redo supported in TextFields.
- Cocoa: File open requests sent to a running application
from the Finder are handled.
- Cocoa: Expanded BlobEdit example to demonstrate
- resource handling
- building an application using py2app, with file and
application icons and launching from the Finder by
opening an associated file.
API changes:
- Application.make_new_document() and make_file_document()
abstract methods collapsed into a single make_document()
method.
- You should no longer call new_cmd() from your application's
__init__. Instead, do this in your implementation of
Application.open_app() if needed.
Bug fixes:
- Frames did not work.
- Error in the installation instructions in the README file
corrected.
- Cocoa: Attempting to create a Font with an unsupported
combination of attributes now results in fallback to the
application font instead of a crash.
- Cocoa, Gtk: Canvas.xxx_arc() methods did not work.
- Gtk: Stroking an unclosed path did not work.
- Cocoa: Return/Enter in single-line text field was not
propagated to containing components.
- Setup.py did not install the standard cursor resources.
- Documentation of alert functions adjusted (caution_alert
removed, stop_alert added).
- Cocoa: Drawing text with a foreground colour other than
black did not work.
- Gtk: Fixed glitches in selection handling when switching
focus between TextFields.
- Gtk: Text can no longer be copied out of a password
entry field.
- Cocoa: Edit menu commands did not work in a Cocoa-defined
dialog (e.g. save file dialog).
- Cocoa: Custom cursor of a ScrollableView now appears only in
the content area, instead of over the scroll bars as well.
- Cocoa: Update the window change dot when document need saving.
1.7.1
-----
New features:
- Slider control.
- run() convenience function, equivalent to application().run().
- Geometry.rects_intersect() function.
Enhancements:
- Files given on the command line will be opened when run() is
called.
- BlobEdit example application now demonstrates use of the
update_rect parameter to View.draw().
Bug fixes:
- Disabled a debugging statement that was inadvertently left on
in Cursor.__init__.
- Changed the package name in setup.py to something more meaningful
than 'foo'.
1.7
---
New features:
- OpenGL: DisplayList class for managing display lists,
analogous to the Texture class.
- Cursor class and 'cursor' property of Views.
- Facilities for locating resource files associated with the
application.
Modifications:
- Cocoa: More informative error message produced when an application
is run with python instead of pythonw.
- Cocoa: View.track_mouse() now allows Tasks to run while the mouse is
being tracked.
- Cocoa: Exceptions occurring during the firing of a Task are propagated
to the main event loop for handling.
- Documentation added for class Task.
- OpenGL: API for context sharing has been changed. Instead of passing one
GLView or GLPixmap as the 'share' argument to the constructor of another,
there is now a class GL.ShareGroup which is passed to a GLView or GLPixmap
constructor as 'share_group'.
- GL.Texture instances now deallocate associated OpenGL resources
when they are no longer referenced.
- The 'binary' attribute of class Document now defaults to true. If false,
the document's file is opened for reading in universal newlines mode.
- Cocoa: Setting the Macintosh creator and type code of a file using a
FileRef and FileType is now implemented.
- RadioGroups are now iterable, so they can be used directly in the
place_row() and place_column() methods of a Container.
Bug fixes:
- Cocoa: Getting the extent property of a ScrollableView did not work.
- Cocoa: Worked around a PyObjC bug that was causing Tasks to leak memory.
- Cocoa: Request New File dialog with a file type having a Macintosh
type code did not work.
1.6.1
-----
Bug fixes:
- Mouse down event in a GLView caused a crash.
- Canvas methods fill_poly() and stroke_poly() didn't work. Added
a test for these.
1.6
---
Implementation changes:
- The Macintosh implementation has been completely rewritten to
use Cocoa instead of Carbon. The Carbon version is no longer
supported.
API changes:
There are some backward-incompatible changes to the API in this
version. Apologies if this causes inconvenience, but I feel it's
important to get the API right while there's still a chance.
- A ScrollableView class has been introduced which encapsulates all
details of scrolling. The View class is no longer scrollable.
The ScrollFrame class has been removed.
- View.draw() is now passed a second parameter indicating the
rectangle needing to be drawn.
- Canvas.frame_arc() and Canvas.fill_arc() only support circular
arcs, and take a centre and radius instead of a rectangle.
- Menu constructor now takes a single parameter containing a list
of item descriptors, instead of taking each descriptor as a
separate argument.
- The Application.std_menu_bar property has been removed. Use the new
StdMenus.basic_menus() function instead.
- The visible property and the show() and hide() methods are now
only defined for Windows, not Components in general.
Behaviour changes:
- ModalDialog.dismiss() also hides the dialog.
- Setting TextField.selection also makes the text field the target.
- TextField.select_all() also makes the text field the target.
New features:
- FileType class for platform-specific file type metadata
- Window.auto_position property
- Alpha channel support added to API (not fully implemented
on all platforms yet).
- New Canvas methods: stroke_rect(), stroke_arc(), stroke_oval(),
stroke_poly()
- New OpenGL-related classes: GLConfig, GLPixmap, Texture
- Key names for function keys added
- Frame class (general-purpose plain vanilla Container)
- Enhanced facilities for creating and modifying menus (still under
development):
- StdMenus module to hold stuff related to standard menus
- MenuList class with facilities for finding menus by command
- Menu class can have items added to it after construction
See the new doc section "Customising the Standard Menu Bar" for
more information.
- The BlobEdit example application has been improved. You can now
get rid of unwanted blobs by shift-clicking on them.
1.5.3 (not released)
-----
Bug fixes:
- Modal dialogs can now be dismissed with None as the return value.
- Mouse events in a GLView were being reported in the coordinate
system of the view's container rather than the view itself.
- Menu items were not being disabled and unchecked before menu
setup.
- The list of objects observing a Model is now kept outside of
the model object, to make pickling of models easier.
- Mac: Shift & option menu command key modifiers did not work.
- Mac: Setting the width or height of a view's extent to zero caused a
crash when calculating scroll bar values.
- Mac: Reading the font property of a Canvas did not work.
- Mac: Setting the selection of a TextField did not work.
- Mac: Font, colour and justification settings of controls interacted
in strange ways.
Enhancements:
- update() method added to View and GLView for immediate redrawing.
- ModalDialog.dismiss() now hides the dialog.
1.5.2 (not released)
-----
Modifications:
- GLView.with_context() now returns the return value of the supplied
function.
- Application.quit_cmd() now destroys all windows before exiting
the event loop (previously only those belonging to a document
were destroyed).
1.5.1
-----
Bug fixes:
- Menu item groups did not work.
- Mac: Labels were not updated properly on changing the text property.
- Mac: Setup script failed when Pyrex was not available.
New examples:
- Tests/08-menu.py now includes an example of using a menu item group.
1.5
---
New features:
- OpenGL view component added.
1.4
---
New features:
- Image class for loading and drawing RGB images.
- Pixmap class for offscreen drawing.
- Containers now have a shrink_wrap() method to facilitate
bottom-up component layout strategies. See class Frame.
Bug fixes:
- Access to 'text' property of TextField in password mode didn't work.
- TextField not refreshed properly when 'text' property changed.
- Distutils script did not install subdirectories of the GUI package.
API changes:
- 'password' property of TextField is now initialize-only.

View File

@ -0,0 +1,3 @@
run dist/blobedit.app/Contents/MacOS/blobedit
where
q

View File

@ -0,0 +1,2 @@
app:
python setup.py py2app

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,73 @@
(lp0
(i__main__
Blob
p1
(dp2
S'rect'
p3
(F40.0
F16.0
F80.0
F56.0
tp4
sba(i__main__
Blob
p5
(dp6
g3
(F77.0
F89.0
F117.0
F129.0
tp7
sba(i__main__
Blob
p8
(dp9
g3
(F182.0
F53.0
F222.0
F93.0
tp10
sba(i__main__
Blob
p11
(dp12
g3
(F98.0
F206.0
F138.0
F246.0
tp13
sba(i__main__
Blob
p14
(dp15
g3
(F200.0
F147.0
F240.0
F187.0
tp16
sba(i__main__
Blob
p17
(dp18
g3
(F219.0
F251.0
F259.0
F291.0
tp19
sba(i__main__
Blob
p20
(dp21
g3
(F310.0
F194.0
F350.0
F234.0
tp22
sba.

View File

@ -0,0 +1,73 @@
(lp0
(i__main__
Blob
p1
(dp2
S'rect'
p3
(I55
I71
I95
I111
tp4
sba(i__main__
Blob
p5
(dp6
g3
(I245
I71
I285
I111
tp7
sba(i__main__
Blob
p8
(dp9
g3
(F150.0
F181.0
F190.0
F221.0
tp10
sba(i__main__
Blob
p11
(dp12
g3
(F119.0
F198.0
F159.0
F238.0
tp13
sba(i__main__
Blob
p14
(dp15
g3
(F189.0
F202.0
F229.0
F242.0
tp16
sba(i__main__
Blob
p17
(dp18
g3
(I230
I225
I270
I265
tp19
sba(i__main__
Blob
p20
(dp21
g3
(I73
I224
I113
I264
tp22
sba.

View File

@ -0,0 +1,73 @@
(lp0
(i__main__
Blob
p1
(dp2
S'rect'
p3
(F239.0
F101.0
F279.0
F141.0
tp4
sba(i__main__
Blob
p5
(dp6
g3
(F171.0
F45.0
F211.0
F85.0
tp7
sba(i__main__
Blob
p8
(dp9
g3
(F193.0
F58.0
F233.0
F98.0
tp10
sba(i__main__
Blob
p11
(dp12
g3
(F216.0
F78.0
F256.0
F118.0
tp13
sba(i__main__
Blob
p14
(dp15
g3
(F259.0
F123.0
F299.0
F163.0
tp16
sba(i__main__
Blob
p17
(dp18
g3
(F282.0
F151.0
F322.0
F191.0
tp19
sba(i__main__
Blob
p20
(dp21
g3
(F307.0
F176.0
F347.0
F216.0
tp22
sba.

View File

@ -0,0 +1,73 @@
(lp0
(i__main__
Blob
p1
(dp2
S'rect'
p3
(I55
I71
I95
I111
tp4
sba(i__main__
Blob
p5
(dp6
g3
(I245
I71
I285
I111
tp7
sba(i__main__
Blob
p8
(dp9
g3
(I153
I272
I193
I312
tp10
sba(i__main__
Blob
p11
(dp12
g3
(I107
I258
I147
I298
tp13
sba(i__main__
Blob
p14
(dp15
g3
(I194
I257
I234
I297
tp16
sba(i__main__
Blob
p17
(dp18
g3
(I230
I225
I270
I265
tp19
sba(i__main__
Blob
p20
(dp21
g3
(I73
I224
I113
I264
tp22
sba.

View File

@ -0,0 +1,132 @@
#
# BlobEdit - A totally silly application for showing
# ======== off the GUI framework and providing an example
# of its use.
#
# Blobs are red squares that you place on a Blob Document
# by clicking and move around by dragging. You can save
# your blob arrangement in a file and load it back later
# to impress your friends (or send them away screaming).
#
# News flash: Got a blob you don't want? Now you can
# get rid of it by shift-clicking it! Isn't that useful!
#
import pickle
from GUI import Application, ScrollableView, Document, Window, Cursor, rgb
from GUI.Files import FileType
from GUI.Geometry import pt_in_rect, offset_rect, rects_intersect
from GUI.StdColors import black, red
class BlobApp(Application):
def __init__(self):
Application.__init__(self)
self.blob_type = FileType(name = "Blob Document", suffix = "blob",
#mac_creator = "BLBE", mac_type = "BLOB", # These are optional
)
self.file_type = self.blob_type
self.blob_cursor = Cursor("blob.tiff")
def open_app(self):
self.new_cmd()
def make_document(self, fileref):
return BlobDoc(file_type = self.blob_type)
def make_window(self, document):
win = Window(size = (400, 400), document = document)
view = BlobView(model = document, extent = (1000, 1000), scrolling = 'hv',
cursor = self.blob_cursor)
win.place(view, left = 0, top = 0, right = 0, bottom = 0, sticky = 'nsew')
win.show()
class BlobView(ScrollableView):
def draw(self, canvas, update_rect):
canvas.erase_rect(update_rect)
canvas.fillcolor = red
canvas.pencolor = black
for blob in self.model.blobs:
if blob.intersects(update_rect):
blob.draw(canvas)
def mouse_down(self, event):
x, y = event.position
blob = self.model.find_blob(x, y)
if blob:
if not event.shift:
self.drag_blob(blob, x, y)
else:
self.model.delete_blob(blob)
else:
self.model.add_blob(Blob(x, y))
def drag_blob(self, blob, x0, y0):
for event in self.track_mouse():
x, y = event.position
self.model.move_blob(blob, x - x0, y - y0)
x0 = x
y0 = y
def blob_changed(self, model, blob):
self.invalidate_rect((0,0,self.extent[0],self.extent[1]))
class BlobDoc(Document):
blobs = None
def new_contents(self):
self.blobs = []
def read_contents(self, file):
self.blobs = pickle.load(file)
def write_contents(self, file):
pickle.dump(self.blobs, file)
def add_blob(self, blob):
self.blobs.append(blob)
self.changed()
self.notify_views('blob_changed', blob)
def find_blob(self, x, y):
for blob in self.blobs:
if blob.contains(x, y):
return blob
return None
def move_blob(self, blob, dx, dy):
self.notify_views('blob_changed', blob)
blob.move(dx, dy)
self.changed()
self.notify_views('blob_changed', blob)
def delete_blob(self, blob):
self.notify_views('blob_changed', blob)
self.blobs.remove(blob)
self.changed()
class Blob:
def __init__(self, x, y):
self.rect = (x - 20, y - 20, x + 20, y + 20)
def contains(self, x, y):
return pt_in_rect((x, y), self.rect)
def intersects(self, rect):
return rects_intersect(rect, self.rect)
def move(self, dx, dy):
self.rect = offset_rect(self.rect, (dx, dy))
def draw(self, canvas):
canvas.fill_frame_rect(self.rect)
BlobApp().run()

View File

@ -0,0 +1,31 @@
import sys
print sys.path
from distutils.core import setup
import py2app
setup(
app=['blobedit.py'],
data_files=[
'Resources/blob.tiff',
'Resources/blob_file.icns',
'Resources/blob_app.icns'
],
options = dict(
py2app = dict(
#includes = ['objc', 'Foundation', 'AppKit'],
#packages = ['GUI'],
plist = dict(
#CFBundleSignature = "BLBE", # If you are using mac_creator
CFBundleIconFile = "blob_app",
CFBundleDocumentTypes = [
dict(CFBundleTypeName = "BlobEdit Document",
CFBundleTypeRole = "Editor",
#CFBundleTypeOSTypes = ["BLOB"], # If you are using mac_type
CFBundleTypeExtensions = ["blob"],
CFBundleTypeIconFile = "blob_file",
)]
),
),
)
)

View File

@ -0,0 +1,22 @@
from GUI import ModalDialog, Label, Button, Task, application
class NagBox(ModalDialog):
def __init__(self, text, timeout):
ModalDialog.__init__(self)
label = Label(text)
self.ok_button = Button("OK", action = "ok", enabled = False)
self.place(label, left = 20, top = 20)
self.place(self.ok_button, top = label + 20, right = label.right)
self.shrink_wrap(padding = (20, 20))
self.timer = Task(self.enable_button, timeout)
def enable_button(self):
self.ok_button.enabled = True
def ok(self):
self.dismiss(True)
dlog = NagBox("Consider yourself nagged.", 10)
dlog.present()

View File

@ -0,0 +1,228 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"><title>Application</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>class <tt>Application(MessageHandler)</tt></h1>
<p>Each application has exactly one Application object, which
looks after application-wide concerns such as maintaining the set of
windows and documents, running the event loop, and handling global menu
commands.</p>
<h2>Global Functions</h2>
<dl>
<dt><tt>application()</tt></dt>
<dd>Returns the Application instance. The first time an
instance of Application or a subclass of Application is created, a
global reference to it is stored; the <tt>application</tt>
function returns this reference.<br>
</dd>
<dd>If this function is called before any application object
has been created, it creates an instance of class Application
automatically.</dd>
</dl>
<h2>Constructor</h2>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">Application(title =
None)</dt>
<dd>Creates and initializes an Application. The <span style="font-style: italic;">title</span> must be
specified as a keyword argument; it
defaults to the name of the main Python file, or in the case of a
MacOSX application built with Py2App, it is taken from the info.plist
resource.</dd>
</dl>
<h2>Properties</h2>
<blockquote>
<dl>
<dt><tt>menus</tt></dt>
<dd>List of application-wide Menu instances. These menus will
always be
available regardless of which window is active.<br>
<br>
</dd>
<dd><i>Do not modify the contents of this list
directly. </i>If you want to add or remove menus, build a new
list of menus and assign the whole
list to the <tt>menus</tt> property. Otherwise, the
displayed menus may
not be updated properly.</dd>
</dl>
<dl>
<dt><tt>windows</tt></dt>
<dd><i>Read only</i>. List of all currently
existing Window&nbsp;instances.<span style="font-style: italic;">
Do not modify this list.</span><br>
</dd>
</dl>
<dl>
<dt><tt>documents</tt></dt>
<dd><i>Read only</i>. List of all currently
existing Document&nbsp;instances.<span style="font-style: italic;"> Do not modify this list.</span><br>
<br>
</dd>
<dt style="font-family: monospace;">open_file_types</dt>
<dd>A list of <a href="FileType.html">FileType</a>s
specifying the types of files that can be opened by the <span style="font-weight: bold;">Open...</span>
command. If empty, any type of file is acceptable. You only need to set
this if you want to make use of the default implementation of the <span style="font-weight: bold;">Open...</span> command.<br>
<br>
</dd>
<dt style="font-family: monospace;">save_file_type</dt>
<dd>A <a href="FileType.html">FileType</a>
specifying the default file type for Documents that don't specify one
of their own. You only need to set
this if you want to make use of the default implementations of the <span style="font-weight: bold;">Save</span> and <span style="font-weight: bold;">Save As...</span> commands,
and you don't explicitly set the <span style="font-family: monospace;">file_type</span>
property of all your Documents.<br>
<br>
</dd>
<dt style="font-family: monospace;">file_type</dt>
<dd><span style="font-style: italic;">Write only.</span>
This is a convenience property for applications that only deal with one
type of file. Setting it to a FileType <span style="font-style: italic;">f</span> is the same as
setting <span style="font-family: monospace;">open_file_types</span>
to <span style="font-family: monospace;">[</span><span style="font-style: italic;">f</span><span style="font-family: monospace;">]</span> and <span style="font-family: monospace;">save_file_type</span>
to <span style="font-style: italic;">f</span>.<br>
<br>
</dd>
<dt style="font-family: monospace;">target</dt>
<dd><span style="font-style: italic;">Read-only.</span>
The object which is the current target of keyboard events and menu
commands. This will be a Component contained within the frontmost
window, the frontmost window itself, or if there are no windows, the
Application itself.<br>
<br>
</dd>
<dt style="font-family: monospace;">target_window</dt>
<dd><span style="font-style: italic;">Read-only.
</span>The Window containing the current target of keyboard
events and menu commands, or None if there are no windows.</dd>
</dl>
<dl>
</dl>
</blockquote>
<h2>Attributes</h2><dl style="margin-left: 40px;"><dt style="font-family: monospace;">page_setup</dt><dd>A default application-wide <a href="PageSetup.html">PageSetup</a> instance that is edited by the generic implementation of the <span style="font-style: italic;">Page Setup</span> command and used by default implementations of the <span style="font-style: italic;">Print</span> command.</dd></dl><h2>Methods</h2>
<blockquote>
<dl>
<dt><tt>run()</tt></dt>
<dd>The main event loop. A program calls this method after
initialisation, and it retains control until the application is quit.
Catches any unhandled exceptions and reports them to the user via <span style="font-family: monospace;">report_exception()</span>.<br>
<br>
The normal method of quitting the application is to call <span style="font-family: monospace;">quit_cmd()</span>.
This gives the user the opportunity to close any open documents and
save any unsaved changes. If this is undesirable for some reason, a
more direct exit can be achieved using <span style="font-family: monospace;">_quit()</span>.<br></dd></dl>
</blockquote>
<blockquote>
<dl>
<dt style="font-family: monospace;">event_loop()</dt>
<dd>Runs an event loop, fetching and handling input events
until <span style="font-family: monospace;">exit_event_loop()</span>
is called.<br>
<br>
If a <span style="font-family: monospace;">Cancel</span>
exception is raised during the event loop, it is silently caught and
the event loop continues. The handling of an exception of any other
type is platform-dependent; it may break the event loop and be
propagated, or it may be handled within the loop using <span style="font-family: monospace;">report_exception()</span>.<br><br></dd>
<dt style="font-family: monospace;">exit_event_loop()</dt>
<dd>Causes the current call to <span style="font-family: monospace;">event_loop()</span><span style="font-family: monospace;"></span> to
exit.<br>
<br>
</dd>
<dt style="font-family: monospace;"><a name="report_exception"></a>report_exception()</dt>
<dd>Displays an alert box reporting the current exception (as
determined by <span style="font-family: monospace;">sys.exc_info()</span>)
and giving the user the option of continuing, getting a traceback or
exiting the application.</dd>
</dl>
<dl>
</dl>
<dl>
<dt><tt>new_cmd()</tt></dt>
<dd>Implements the standard <b>New </b>command.
Calls <tt>make_document</tt> to create a new document,
initialises it as an empty document, and calls <tt>make_window</tt>
to create an initial window for it.</dd>
</dl>
<dl>
<dt><tt><a name="open_cmd"></a>open_cmd()</tt></dt>
<dd>Implements the standard <b>Open...</b>
command. Requests a file name from the user, calls <tt>make_document</tt>
to create a document, loads the document from the file, and calls <tt>make_window</tt>
to create an initial window for it.</dd>
</dl>
<dl>
<dt><tt>quit_cmd()</tt></dt>
<dd>Implements the standard <b>Quit </b>command.
Asks the user whether to save changes to any changed documents, and if
the user doesn't cancel, raises a <tt>Quit</tt> exception.<br><br></dd><dt style="font-family: monospace;">page_setup_cmd()</dt><dd>Default implementation of the <span style="font-weight: bold;">Page Setup...</span> command. Edits the PageSetup instance referred to by the <span style="font-family: monospace;">page_setup</span> attribute.</dd>
</dl>
<dl>
<dt><tt>query_clipboard()</tt></dt>
<dd>Returns true if the clipboard contains any data. This is
likely to
be more efficient than testing the result of <tt>get_clipboard()</tt>.</dd>
</dl>
<dl>
<dt><tt>get_clipboard()</tt></dt>
<dd>Returns the current contents of the clipboard as a
string, or an
empty string if the clipboard contains no data.<br>
</dd>
</dl>
</blockquote>
<blockquote>
<dl>
<dt><tt>set_clipboard(</tt><i>data</i><tt>)</tt></dt>
<dd>Replaces the contents of the clipboard with the given
data, which
should be a string.</dd>
</dl>
</blockquote>
<ul>
</ul>
<blockquote> <dl><dt style="font-family: monospace;">_quit()</dt><dd>Exits the main event loop immediately, without giving any option to save changes. For emergency use only.</dd></dl></blockquote>
<h2>Abstract Methods</h2>
<blockquote>
<dl>
<dt style="font-family: monospace;">open_app()</dt>
<dd>This
method is called when the application is started without any
command-line arguments. The default implementation does nothing. In a
document-based application, you will typically override it to call the <span style="font-family: monospace;">new_cmd()</span>
method to create a new, empty document.<br>
</dd>
</dl>
<dl>
<dt><tt>make_document(</tt>file_ref<tt> </tt><span style="font-style: italic;">or</span><tt> None)</tt></dt>
<dd>If you want to use the built-in support for the <span style="font-weight: bold;">New</span> or <span style="font-weight: bold;">Open...</span>
commands, you need to implement this method.<br>
<br>
If the <span style="font-weight: bold;">file_ref</span>
argument is None, you should create a new Document object of the
appropriate class in response to a <b>New </b>command.<br>
<br>
Otherwise, should
create a new Document object of the appropriate class for
the file represented by the given <a href="FileRef.html">FileRef</a>.
You may
examine the file name, read the beginning of the file or do whatever
else
is necessary to determine what class of object to create. If you can't
recognise the file, you should return None, and an appropriate error
message will be displayed. The default implementation returns None.<br>
</dd>
</dl>
<dl>
<dt><tt>make_window(</tt>document<tt>)</tt></dt>
<dd>If you want to use the built-in support for the <span style="font-weight: bold;">New</span> and <span style="font-weight: bold;">Open...</span>
commands,&nbsp;you need to implement this method. Your
implementation
should create a Window containing a component hierarchy suitable
for viewing the given Document object. There is no default
implementation.<br><br></dd><dt><tt>get_default_open_directory()</tt></dt><dd>Called by the default implementation of <a href="#open_cmd"><tt>open_cmd()</tt></a> to find an initial directory for <a href="file_dialogs.html#request_old_file"><tt>request_old_file()</tt></a>. Should return a <a href="DirRef.html">DirRef</a> or <a href="FileRef.html">FileRef</a>, or&nbsp; None if there is no preferred location.<br><br>The default implementation returns the last directory in which a document was opened or saved during this session.</dd>
</dl>
</blockquote>
<p>---</p>
</body></html>

View File

@ -0,0 +1,49 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - class Button</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>class <tt>Button(<a href="Control.html">Control</a>)</tt></h1>
<p>A Button is a momentary-action pushbutton, invoking an action
when it is
clicked.<br>
</p>
<h2>Constructors</h2>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">Button(title)</dt>
<dd><br>
Creates a generic pushbutton with the given title.<br>
<br>
</dd></dl><h2>Properties</h2>
<dl style="margin-left: 40px;">
<dt><tt>title</tt></dt>
<dd>Title string to display inside the button.</dd>
<dd><br>
</dd>
<dt><tt>style</tt></dt>
<dd>One of <tt>'normal'</tt>, <tt>'default'</tt>
or <tt>'cancel'</tt>. Setting this to&nbsp;<tt>'default'</tt>
or <tt>'cancel</tt> causes the button to take on the
appearance of a default button or a cancel button respectively,
according to platform conventions. (This property only affects the
appearance
of the button, it does not automatically make the button
respond to
keyboard commands.)</dd>
</dl>
<h2>Action Properties</h2>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">action</dt>
<dd>Action to perform when the button is clicked. See <a href="actions.html">Actions</a>.</dd>
</dl>
<h2>Methods</h2>
<blockquote>
<dl>
<dt><tt>activate()</tt></dt>
<dd>Animates a simulation of the button being pressed
momentarily, and then invokes its action.</dd>
</dl>
</blockquote>
<br>
<br>
</body></html>

496
PyGUI-2.5.3/Doc/Canvas.html Normal file
View File

@ -0,0 +1,496 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - class Canvas</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]">
<style type="text/css"></style></head>
<body>
<h1>class <tt>Canvas </tt></h1>
<p>Canvas is an abstract class representing something that can be
drawn upon. It may represent an area of the screen, an offscreen
pixmap, or something else such as a printed page.<br>
</p>
<p>The drawing model of a Canvas is based on the Postscript
drawing model. In this model, drawing is performed by first building up
a geometric description of a <i>path</i>, and then <i>stroking</i>
the path with a pen or <i>filling</i>
the path with a colour, or both. Paths can also be used to define a <i>clipping
region</i> to which subsequent drawing is restricted.</p>
<p>The Postscript model is extended with the additional
drawing operations:</p><ul><li> <span style="font-weight: bold;">Erasing</span>
is filling the path with a background colour. On platforms supporting
alpha transparency, the background colour completely replaces the
colour in the existing image, instead of being blended with it as is
the case for the other drawing operations.<br><br></li><li><span style="font-weight: bold;">Framing</span> is
similar to stroking, except that the pen is moved around the inside of
the path instead of being centred on the path. It is equivalent to stroking a path displaced inwards by half the pen size.<br>
</li></ul>
<p>Higher-level operations are also provided for convenient
drawing of common shapes such as rectangles, ellipses, arcs and
polygons.<br>
</p>
<h2>Graphics state</h2>
Each canvas maintains a <i>graphics state</i> consisting
of the following items:<br>
<ul>
<li>A <i>pen colour</i> and <span style="font-style: italic;">pen size</span> for
stroking and framing operations.</li>
<li>A <i>fill colour</i> for filling operations.</li><li>A <span style="font-style: italic;">text colour</span> for drawing text.</li>
<li>A <span style="font-style: italic;">background
colour</span> for erasing operations.</li>
<li>A<i> font</i> for drawing text.</li>
<li>A <i>current point</i> used in path
construction and text drawing.<br>
</li>
<li>A <i>clipping region</i> to which all drawing
operations are restricted.</li>
</ul>
The canvas also maintains a <i>graphics state stack</i>. The
current graphics state can be saved by pushing it onto the stack with <span style="font-family: monospace;">gsave</span>, and
restored by popping it from the stack with <span style="font-family: monospace;">grestore</span>.<br>
<h2>Current path</h2>
Each canvas has a <i>current path</i>. The current path
consists of a collection of path <i>segments</i>, each of
which is a sequence of straight lines and/or Bezier curves. Each path
segment can be either <i>open</i> or <i>closed</i>.
Some operations expect closed path segments, in which case an open
segment is treated as though it were closed by a line connecting its
last point to its first point.<br>
<br>
Paths are constructed using the <tt>newpath</tt>,<tt>
moveto</tt>,<tt> lineto</tt>,<tt> rmoveto</tt>,<tt>
rlineto</tt>,<tt> curveto</tt>,<tt> rcurveto</tt>,<tt>
arc</tt> and <tt>closepath</tt> methods. There are
also some higher-level methods for adding commonly-used geometric
shapes to the path.<br><br>Once constructed, a path can be used in the following ways:<br>
<ul>
<li>It can be <i>stroked</i> with the current pen
colour and size using the <tt>stroke</tt> method.</li>
<li>It can be <i>filled</i> with the current fill
colour using the <tt>fill</tt> method.</li>
<li>It can be both filled and stroked using the <span style="font-family: monospace;">fill_stroke</span>
method.</li>
<li>It can be <span style="font-style: italic;">erased</span> with the current background colour using
the <span style="font-family: monospace;">erase</span>
method.</li>
<li>It can be used to restrict the current clipping region (see
below) using the <tt>clip</tt> method.</li>
</ul>
Note that the current path is <span style="font-style: italic;">not</span> part of the
state saved on the graphics state stack, and is unaffected by <span style="font-family: monospace;">gsave</span> and <span style="font-family: monospace;">grestore</span>.<span style="font-style: italic;"></span><br><h3>Overlapping path elements</h3>If
the lines and curves making up a path intersect, or the regions they
enclose overlap, the region enclosed by the path as a whole is
determined using the <span style="font-style: italic;">even-odd winding number rule</span>.
Under this rule, the overlapping regions behave as though they were
"exclusive-or"ed together. Thus, you can create a region with a hole in
it using one segment for the outer boundary and another one for the
boundary of the hole.<br><br>Note that this only works for segments
belonging to a single path. Segments of different paths are independent
and do not exclusive-or together.<span style="font-style: italic;"><br></span>
<h2>Current point</h2>Path construction makes use of the <span style="font-style: italic;">current point</span>.
When a line or curve is added to a path, the current point is used as
the first point of the element, and the last point of the element
becomes the new current point. The current point is also used by
certain other operations such as text drawing.<br><br>Under certain circumstances, the current point may be <span style="font-style: italic;">undefined</span>. The current point is undefined when a new path has been started using <span style="font-family: monospace;">newpath</span>, and after a path segment has been closed using <span style="font-family: monospace;">closepath</span> or by calling one of the higher-level methods that adds a closed shape to the path. The current point becomes defined when <span style="font-family: monospace;">moveto</span> or <span style="font-family: monospace;">rmoveto</span> is called, or a line or curve is added to the path.<br>
<br>Some methods require the current point to be defined. The result of
calling these methods when the current point is undefined is
platform-dependent.<br><h2>Drawing text</h2>
Text is drawn using the <tt>show_text</tt> method, which
draws a string
in the current font and text colour, starting at the current point. The
current
point is then advanced to the end of the string, ready for drawing
another
string.<br>
<h2>Drawing Images</h2>
Images and Pixmaps can also be drawn on Canvases, using methods
provided by those classes. See <a href="ImageBase.html">ImageBase</a>
for details.<br>
<h2>Clipping</h2>
Each canvas has a <span style="font-style: italic;">clipping
region</span> to which all drawing is clipped. The initial
clipping region depends on the type of canvas and the circumstances
under which it was created. For&nbsp;a canvas passed to a view's <tt>draw</tt>
method, it is the region of the view requiring drawing. For a canvas
obtained by calling a view's <tt>with_canvas</tt> method,
it is the viewed rectangle.<br>
<br>
The clipping region can be modified by the <span style="font-family: monospace;">clip</span> and <span style="font-family: monospace;">rectclip</span>
methods, which set the clipping region to the intersection of the
current clipping region and a path or rectangle. There is no explicit
way of enlarging the clipping region, so modifications to the clipping
region should normally be made within a <span style="font-family: monospace;">gsave</span>/<span style="font-family: monospace;">grestore</span> pair
to restore the previous clipping region afterwards.<br>
<h2>Higher-level operations</h2>
In addition to the primitive operations making up the drawing model,
there are a number of higher-level drawing methods which provide more
convenient ways of drawing commonly-used shapes.<br>
<br>
The available shapes are:<br>
<ul>
<li style="font-weight: bold;">Rectangle</li>
<li><span style="font-weight: bold;">Oval</span>
- an ellipse defined by a bounding rectangle.</li>
<li><span style="font-weight: bold;">Arc</span>
- a circular arc defined by a centre point, radius and start and end
angles.</li>
<li><span style="font-weight: bold;">Wedge</span>
- a "pie slice" shape consisting of a circular arc together with two radial lines from
the centre point to the endpoints of the arc.</li>
<li><span style="font-weight: bold;">Polyline</span>
- a connected sequence of straight lines.</li>
<li><span style="font-weight: bold;">Polygon</span>
- a sequence of straight lines forming a closed polygon.</li><li><span style="font-weight: bold;">Polycurve</span> - an open sequence of connected Bezier curves.</li><li><span style="font-weight: bold;">Loop</span> - a closed sequence of connected Bezier curves.</li>
</ul>
Note
that the Arc, Polyline and Polycurve are considered open shapes, even if the
starting and ending points coincide. For corresponding closed shapes,
use an Oval, Poly or Loop respectively.<br><br>Operations
are provided both for adding these shapes to a path, and for drawing
them directly without having to construct a path first.<br>
<h3>Summary of Operations</h3>
The following matrix of higher-level operations is supported.<br>
<br>
<table style="text-align: left;" border="1" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; white-space: nowrap; text-align: left;"></td>
<td style="font-weight: bold; text-align: center;" nowrap="nowrap" valign="top">Add to<br>Path</td>
<td style="font-weight: bold; text-align: center;" nowrap="nowrap" valign="top">Fill</td>
<td style="font-weight: bold; text-align: center;" nowrap="nowrap" valign="top">Stroke</td>
<td style="font-weight: bold; text-align: center;" nowrap="nowrap" valign="top">Frame</td>
<td style="font-weight: bold; text-align: center;" nowrap="nowrap" valign="top">Fill and Stroke</td>
<td style="font-weight: bold; text-align: center;" nowrap="nowrap" valign="top">Fill and Frame</td>
<td style="font-weight: bold; text-align: center;" nowrap="nowrap" valign="top">Erase</td>
</tr>
<tr>
<td style="font-weight: bold;" align="left" nowrap="nowrap" valign="top">Path</td>
<td align="left" nowrap="nowrap" valign="top"></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>fill</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>stroke</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>fill_stroke</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
</tr>
<tr>
<td style="font-weight: bold;" align="left" nowrap="nowrap" valign="top">Rectangle</td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>rect</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>fill_rect</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>stroke_rect</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>frame_rect</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>fill_stroke_rect</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>fill_frame_rect</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>erase_rect</small></td>
</tr>
<tr>
<td style="font-weight: bold;" align="left" nowrap="nowrap" valign="top">Oval</td>
<td style="vertical-align: top; white-space: nowrap; text-align: left; font-family: monospace;"><small>oval</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>fill_oval</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>stroke_oval</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>frame_oval</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>fill_stroke_oval</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>fill_frame_oval</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>erase_oval</small></td>
</tr>
<tr>
<td style="font-weight: bold;" align="left" nowrap="nowrap" valign="top">Arc</td>
<td style="vertical-align: top; white-space: nowrap; text-align: left; font-family: monospace;"><small>arc</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>stroke_arc</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>frame_arc</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
</tr>
<tr>
<td style="font-weight: bold;" align="left" nowrap="nowrap" valign="top">Wedge</td>
<td style="vertical-align: top; white-space: nowrap; text-align: left; font-family: monospace;"><small>wedge</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>fill_wedge</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>stroke_wedge</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>fill_stroke_wedge</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>erase_wedge</small></td>
</tr>
<tr>
<td style="font-weight: bold;" align="left" nowrap="nowrap" valign="top">Polyline</td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>lines</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>stroke_lines</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
</tr>
<tr>
<td style="vertical-align: top; white-space: nowrap; text-align: left; font-weight: bold;">Polygon</td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>poly</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>fill_poly</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>stroke_poly</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>fill_stroke_poly</small></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"></td>
<td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>erase_poly</small></td>
</tr><tr><td style="font-weight: bold;" align="left" nowrap="nowrap" valign="top">Polycurve</td><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>curves</small></td><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small></small></td><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>stroke_curves</small></td><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small></small></td><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small></small></td><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small></small></td><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small></small></td></tr><tr><td align="left" nowrap="nowrap" valign="top"><span style="font-weight: bold;">Loop</span></td><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>loop</small></td><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>fill_loop</small></td><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>stroke_loop</small></td><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small></small></td><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>fill_stroke_loop</small></td><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small></small></td><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top"><small>erase_loop</small></td></tr>
</tbody>
</table>
<br>Note: There are no filling or erasing operations for Arcs, Polylines and Polycurves because they are open shapes.<br><br>Note:
There are currently no framing operations for Polygons and Loops because there is no
straightforward way of determining an "inwards" direction in which to
displace the pen.<br>
<h2>Properties </h2>
<dl>
<dl>
<dt><tt>pencolor</tt></dt>
<dd>Colour to be used for&nbsp;stroking and framing
operations.<br>
<br>
</dd>
<dt style="font-family: monospace;">fillcolor</dt>
<dd>Colour to be used for filling operations.</dd>
<dd><br></dd><dt style="font-family: monospace;">textcolor</dt><dd>Colour to be used for drawing text.<br><br></dd>
<dt><tt>backcolor </tt></dt>
<dd>Colour to be used for erasing operations.<br><br></dd><dt style="font-family: monospace;">forecolor</dt><dd><span style="font-style: italic;">Write-only.</span> Setting this property sets the pen, fill and text colours to the same colour.</dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>pensize </tt></dt>
<dd>Width of the pen used for stroking and framing. </dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>font </tt></dt>
<dd>Font to be used in text drawing operations.<br><br></dd><dt style="font-family: monospace;">current_point</dt><dd><span style="font-style: italic;">Read-only.</span> The current point. If the current point is undefined, the result is platform-dependent.<br><br></dd><dt style="font-family: monospace;">printing</dt><dd><span style="font-style: italic;">Read-only.</span> True if the canvas is producing output for a printer or other non-display destination.</dd>
</dl>
</dl>
<dl>
<dl>
</dl>
</dl>
<h2>Primitive methods </h2>
<dl>
<dl>
<dt><tt>newpath()</tt></dt>
<dd>Clears the current path.</dd>
<dd><br>
</dd>
<dt><tt>moveto(</tt><i>x</i><tt>,</tt><i>
y</i><tt>)</tt></dt>
<dd>Moves the current point to (<i>x</i>, <i>y</i>).
A subsequent call to <tt>lineto</tt>,<tt> rlineto</tt>,<tt>
curveto</tt>,<tt> rcurveto</tt> or <tt>arc</tt>
will start a new segment of the current path.</dd>
<dd><br>
</dd>
<dt><tt>lineto(</tt><i>x</i><tt>,</tt><i>
y</i><tt>)</tt></dt>
<dd>Adds a straight line to the the current path from the
current point to (<i>x</i>, <i>y</i>), and
then makes (<i>x</i>, <i>y</i>) the current
point.</dd>
<dt><br>
</dt>
<dt><tt>rmoveto(</tt><i>dx</i><tt>,</tt><i>
dy</i><tt>) </tt></dt>
<tt>rlineto(</tt><i>dx</i><tt>,</tt><i>
dy</i><tt>)</tt><dd>The same as <tt>moveto</tt>
and <tt>lineto</tt>, except that the coordinates are
measured relative to
the current point.<br>
<br>
</dd>
<dt><span style="font-family: monospace;">curveto(</span><span style="font-style: italic;">cp1</span><span style="font-family: monospace;">,</span> <span style="font-style: italic;">cp2</span><span style="font-family: monospace;">,</span> <span style="font-style: italic;">ep</span><span style="font-family: monospace;">)</span></dt>
<dd>Adds a Bezier curve to the current path segment starting
at the current point, having control points <span style="font-style: italic;">cp1 </span>and <span style="font-style: italic;">cp2,</span> and ending at
the point <span style="font-style: italic;">ep</span>. The end point of the curve becomes the new current point.<span style="font-style: italic;"></span><br>
<br>
</dd>
<dt><span style="font-family: monospace;">rcurveto(</span><span style="font-style: italic;">cp1</span><span style="font-family: monospace;">,</span> <span style="font-style: italic;">cp2</span><span style="font-family: monospace;">,</span> <span style="font-style: italic;">ep</span><span style="font-family: monospace;">)</span></dt>
<dd>The same as <span style="font-family: monospace;">curveto</span>
except that&nbsp;<span style="font-family: monospace;"></span><span style="font-style: italic;">cp1</span>, <span style="font-style: italic;">cp2</span> and <span style="font-style: italic;">ep</span> are measured
relative to the current point.&nbsp;<span style="font-style: italic;"></span></dd><dd><br>
</dd>
<dt><tt>closepath()</tt></dt>
<dd>Closes the last segment of the current path by adding a
straight line
from its last point to its first point. A subsequent call to&nbsp;<tt>lineto</tt>,<tt>
rlineto</tt>,<tt> curveto</tt>,<tt> rcurveto</tt>
or <tt>arc</tt> will start a new
segment of the current path.</dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>fill() </tt></dt>
<dd>Fills the interior of the current path with the current
fill color. The interior of the path is determined using the even-odd
winding number
rule.<br>
<br>
</dd>
<dt><tt>stroke()</tt></dt>
<dd>Draws a line along the current path using the current pen
size and pen colour. The width of the line is distributed as evenly as
possible either side of the path. The treatment of joins between lines
is implementation-dependent.</dd>
<dd><br>
</dd>
<dt style="font-family: monospace;">fill_stroke()</dt>
<dd>Fills and then strokes the current path.</dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>erase() </tt></dt>
<dd>Fills the interior of the current path with the current
background color. </dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>show_text(</tt><i>string</i><tt>)</tt>
</dt>
<dd>Draws the given text using the current font and
foreground color. The left end of the baseline of the text starts at the current point.
After drawing, the current
point is advanced rightwards along the baseline by the width of the characters
drawn. The effect on the current path is undefined. If the current
point is not defined when this method is called, the result is
platform-dependent. </dd>
</dl>
</dl>
<dl>
<dl>
</dl>
</dl>
<dl>
<dl>
<dt><tt>clip() </tt></dt>
<dd>Replaces the current clipping region with the
intersection of the current clipping region and the interior of the
current path.&nbsp;The interior of the path is determined using the
even-odd winding number rule.<span style="font-style: italic;"></span></dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>gsave() </tt></dt>
<dd>Pushes the current graphics state onto the graphics state
stack.</dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>grestore() </tt></dt>
<dd>Pops the most recently saved graphics state from the
graphics state stack and makes it the current graphics
state.</dd>
<dd><br>
</dd>
<dt><tt>initgraphics()</tt></dt>
<dd>Sets all the elements of the current graphics state to
default values.</dd>
</dl>
</dl>
<h2>Higher-level path methods</h2>
<dl style="margin-left: 40px;">
<dt><span style="font-family: monospace;">rect(</span><span style="font-style: italic;">rect</span><span style="font-family: monospace;">)</span></dt>
<dd>Adds a new closed segment to the current path in the shape
of a
rectangle.<br>
<br>
</dd>
<dt><span style="font-family: monospace;">oval(</span><span style="font-style: italic;">rect</span><span style="font-family: monospace;">)</span></dt>
<dd>Adds a new closed segment to the current path in the shape
of an ellipse bounded by the given rectangle.<br></dd><dd><br>
</dd><dt><span style="font-family: monospace;"><a name="arc"></a>arc(</span><span style="font-style: italic;">centre</span><span style="font-family: monospace;">,</span> <span style="font-style: italic;">radius</span><span style="font-family: monospace;">,</span> <span style="font-style: italic;">start_angle</span><span style="font-family: monospace;">,</span> <span style="font-style: italic;">end_angle</span><span style="font-family: monospace;">)</span></dt><dd>Adds a circular arc to the current path segment with the
given centre and radius. The arc is drawn&nbsp;clockwise from the start
angle to the end angle. Both angles are in degrees&nbsp;clockwise from
the positive <span style="font-style: italic;">x</span>-axis.
If the current point is defined, a straight line is added from
the current point to the start point of the arc. The end point of the
arc becomes the new current point.<span style="font-style: italic;"><br></span><br></dd><dt><span style="font-family: monospace;">wedge(</span><span style="font-style: italic;">centre</span><span style="font-family: monospace;">,</span> <span style="font-style: italic;">radius</span><span style="font-family: monospace;">,</span> <span style="font-style: italic;">start_angle</span><span style="font-family: monospace;">,</span> <span style="font-style: italic;">end_angle</span><span style="font-family: monospace;">)</span></dt><dd>Adds a new closed segment to the current path in the shape of a wedge. The wedge is defined as for <a href="#arc"><span style="font-family: monospace;">arc</span></a>.<br><br></dd>
<dt>
<span style="font-family: monospace;">lines(</span><span style="font-style: italic;">points</span><span style="font-family: monospace;">)</span></dt>
<dd>Adds a new open segment to the current path consisting of a
sequence of straight lines. Equivalent to calling <span style="font-family: monospace;">moveto</span> for the first point and then <span style="font-family: monospace;">lineto</span> for each subsequent point.<br>
<br></dd><dt><span style="font-family: monospace;">linesto(</span><span style="font-style: italic;">points</span><span style="font-family: monospace;">)</span></dt><dd>Adds a connected sequence of straight lines to the current path segment. Equivalent to calling&nbsp;<span style="font-family: monospace;">lineto</span> for each point.<br></dd>
<dt><span style="font-family: monospace;">poly(</span><span style="font-style: italic;">points</span><span style="font-family: monospace;">)</span></dt>
<dd>Adds a new closed segment to the current path in the shape
of a polygon.<br>
<br></dd><dt><span style="font-family: monospace;">curves(</span><span style="font-style: italic;">points</span><span style="font-family: monospace;">)</span></dt><dd>Adds a new open segment to the current path consisting of a
sequence of connected Bezier curves.&nbsp;Equivalent to calling <span style="font-family: monospace;">moveto</span> for the first point and then <span style="font-family: monospace;">curveto</span> for each subsequent group of 3 points.<span style="font-style: italic;"></span><br><br></dd><dt><span style="font-family: monospace;">curvesto(</span><span style="font-style: italic;">points</span><span style="font-family: monospace;">)</span></dt><dd>Adds a sequence of connected Bezier curves to the current path segment.&nbsp;Equivalent to calling&nbsp;<span style="font-family: monospace;">curveto</span> for each consecutive group of 3 points.<span style="font-style: italic;"></span><br><br></dd><dt><span style="font-family: monospace;"><a name="loop"></a>loop(</span><span style="font-style: italic;">points</span><span style="font-family: monospace;">)</span></dt><dd>Adds a new closed segment to the current path consisting of a
sequence of connected Bezier curves. Equivalent to calling <span style="font-family: monospace;">curves</span> followed by <span style="font-family: monospace;">closepath</span>.<span style="font-style: italic;"></span><br></dd>
<dt><tt>rectclip(</tt><i>rect</i><tt>)</tt></dt>
<dd>Replaces the current clipping region with the intersection
of the current clipping region and the given rectangle. The effect on
the current point and current path are undefined.</dd>
</dl>
<h2>Higher-level drawing methods</h2>
Note: The effect of these methods on the current path is undefined.<br>
<blockquote>
<dl>
<dt><tt>fill_rect(</tt><i>rect</i><tt>)<br>
</tt></dt><span style="font-family: monospace;">stroke_rect(</span><span style="font-style: italic;">rect</span><span style="font-family: monospace;">)</span><tt><br>frame_rect(</tt><i>rect</i><tt>)<br>fill_stroke_rect</tt><tt>(</tt><i>rect</i><tt>)</tt><span style="font-family: monospace;"><br></span><tt>fill_frame_rect(</tt><span style="font-style: italic;">rect</span><tt>)<br>
erase_rect</tt><tt>(</tt><span style="font-style: italic;">rect</span><tt>)</tt>
<dd>Performs the indicated operation on the given rectangle.</dd>
<dd>
<br>
</dd>
<dt><tt>fill_oval(</tt><i>rect</i><span style="font-family: monospace;">)</span><br>
<span style="font-family: monospace;"></span><span style="font-family: monospace;">stroke_oval(</span><span style="font-style: italic;">rect</span><span style="font-family: monospace;">)</span></dt>
<dt><tt>frame_oval(</tt><i>rect</i><tt>)<br></tt><span style="font-family: monospace;">fill_stroke_oval</span><tt>(</tt><i>rect</i><span style="font-family: monospace;">)</span></dt>
<dt><span style="font-family: monospace;">fill_frame_oval</span><tt>(</tt><i>rect</i><span style="font-family: monospace;">)</span><br style="font-family: monospace;">
<span style="font-family: monospace;">erase_oval</span><tt>(</tt><i>rect</i><span style="font-family: monospace;">)</span></dt>
<dd>Performs the indicated operation on an ellipse bounded by
the specified
rectangle.<br>
</dd>
<dt></dt>
<dt><tt>stroke_arc</tt><span style="font-family: monospace;">(</span><i>centre,
radius</i><i>, start_angle, end_angle</i><tt>)<br>
</tt></dt>
<dt><tt>frame_arc</tt><span style="font-family: monospace;">(</span><i>centre,
radius</i><i>, start_angle, end_angle</i><tt>)</tt></dt>
<dd>Performs the indicated operation on a circular arc. The arc is defined as for the <a href="#arc">arc</a> method.<br>
</dd>
</dl>
</blockquote>
<blockquote>
<dl>
<dt><tt>fill_wedge(</tt><i>centre,
radius,
start_angle, end_angle</i><tt>)<br>
</tt><tt>stroke_wedge</tt><tt>(</tt><i>centre,
radius,
start_angle, end_angle</i><tt>)</tt></dt>
<dt><tt>fill_stroke_wedge(</tt><i>centre,
radius,
start_angle, end_angle</i><tt>)<br>
</tt><tt>erase_wedge</tt><tt>(</tt><i>centre,
radius,
start_angle, end_angle</i><tt>)</tt></dt>
<dd>Performs the indicated operation on a&nbsp;pie-shaped
wedge.&nbsp;The wedge is defined as for the <a href="Canvas.html#arc">arc</a> method.<br>
<br>
</dd>
<dt><span style="font-family: monospace;">stroke_line</span><tt>s(</tt><i>points</i><tt>)</tt></dt>
<dd>Strokes a sequence of connected line segments.</dd>
<dd><br>
</dd>
<dt><tt>fill_poly</tt><tt>(</tt><i>points</i><tt>)</tt><br>
<tt>stroke_poly(</tt><i>points</i><tt>)<br>
</tt><tt>fill_stroke_poly</tt><tt>(</tt><i>points</i><tt>)</tt><br>
<tt>erase_poly</tt><tt>(</tt><i>points</i><tt>)</tt></dt>
<dd>Performs the indicated operation on a closed polygon.<br><br></dd><dt><tt>fill_loop</tt><tt>(</tt><i>points</i><tt>)</tt><br>
<tt>stroke_loop(</tt><i>points</i><tt>)<br>
</tt><tt>fill_stroke_loop</tt><tt>(</tt><i>points</i><tt>)</tt><br>
<tt>erase_loop</tt><tt>(</tt><i>points</i><tt>)</tt></dt><dd>Performs the indicated operation on a closed sequence of Bezier curves. See <a href="#loop">loop</a>.<span style="font-style: italic;"></span></dd>
</dl>
<dl>
</dl>
</blockquote>
---<br>
</body></html>

View File

@ -0,0 +1,36 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - class CheckBox</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>class <tt>CheckBox(<a href="Control.html">Control</a>)</tt></h1>
<p>A CheckBox is a control which has either two or three possible states. The possible states of a two-state check box are <i>on </i>and <i>off</i>; three-state check boxes may have an additional state <span style="font-style: italic;">mixed</span>.
Clicking the CheckBox changes it from one state to another. Each time
the state changes, its action is performed.</p><span style="font-style: italic;"></span><h2>Constructor</h2><dl style="margin-left: 40px;"><dt style="font-family: monospace;">CheckBox(title)</dt><dd>Constructs a CheckBox with the given title.</dd></dl>
<h2>Properties</h2>
<blockquote> <dl>
<dt><tt>title</tt></dt>
<dd>Title string to be displayed beside the check box.</dd>
<dd><br>
</dd>
<dt><span style="font-family: monospace;">value</span></dt>
<dd>The state of the check box. May have the values <span style="font-family: monospace;">True</span> or <span style="font-family: monospace;">False</span>, and in the case of a three-state check box, <span style="font-family: monospace;">'mixed'</span>.</dd>
<dd><br>
</dd>
<dt><tt>action</tt></dt>
<dd>Action to perform when the user changes the state of the check box.
See <a href="actions.html">Actions</a>.
</dd>
<dd><br>
</dd>
<dt><tt>auto_toggle</tt></dt>
<dd>True if the <tt>on</tt> property is to be automatically changed when
the user clicks the check box. Defaults to true. If set to false, the action
will still be performed when the check box is clicked, but the program
is responsible for changing the state.<br><br></dd><dt style="font-family: monospace;">mixed</dt><dd>If true, the check box can be in a mixed state. Defaults to false.</dd>
</dl>
</blockquote>
<p>---</p>
<br>
<br>
</body></html>

View File

@ -0,0 +1,48 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - class Color</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>class <tt>Color</tt> </h1>
<p>A Color object is used to represent a color for drawing on a <a href="Canvas.html">Canvas</a>. Color objects are immutable.<br>
</p>
<p>Support for alpha values in colors is platform-dependent. On
platforms with no alpha support, alpha values always read as 1.0. Even
if colors with alpha are supported by a platform, alpha values may be
ignored by some operations.<br>
</p>
<h2>Constructor functions </h2>
<dl>
<dt><tt>rgb(</tt><i>red</i><tt>,</tt><i> green</i><tt>,</tt><i> blue</i><span style="font-family: monospace;">,</span> <span style="font-style: italic;">alpha</span> = 1.0<tt>)</tt></dt>
<dd>Returns a Color instance constructed from components in the RGB color space.
Each component should be in the range 0.0 to 1.0.<tt><br>
</tt></dd>
</dl>
<h2>Properties </h2>
<dl>
<dl>
<dt><tt>red </tt></dt>
<dt><tt>green </tt></dt>
<dt><tt>blue<br>
</tt></dt>
<dd><i>Read-only.</i> Components in the RGB color space, in the range
0.0 to 1.0.<br>
<br>
</dd><dt style="font-family: monospace;">alpha</dt>
<dd><i>Read-only. </i>Alpha (opacity) value of the color. 0.0 is fully transparent, 1.0 is fully opaque.<br>
<br>
</dd>
<dt style="font-family: monospace;">rgb</dt>
<dd><i>Read-only. </i>Components of the color as a tuple (<span style="font-style: italic;">red, green, blue</span>).<br>
<br>
</dd>
<dt style="font-family: monospace;">rgba</dt>
<dd><i>Read-only. </i>Components of the color as a tuple (<span style="font-style: italic;">red, green, blue, alpha</span>).</dd>
</dl>
</dl>
<br>
<br>
</body></html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>Column class</title></head>
<body><h1>class <span style="font-family: monospace;">Column(<a href="Frame.html">Frame</a>)</span></h1>A Column is a container that lays out a collection of components in a vertical column.<br><br>The
initial size of the container is made just big enough to hold its
contents. The horizontal alignment of items within the column may be
specified, and one item may optionally be designated to expand vertically when the container is resized. <br><br>In addition, the width and/or height of all items may optionally be equalized before they are laid out.<br><h2>Constructor</h2><dl style="margin-left: 40px;"><dt><span style="font-family: monospace;">Column(</span><span style="font-style: italic;">items</span>, <span style="font-style: italic;">keyword</span> <span style="font-family: monospace;">=</span> <span style="font-style: italic;">value</span><span style="font-family: monospace;">,</span> ...<span style="font-family: monospace;">)</span></dt><dd>Creates a Column containing the specified <span style="font-style: italic;">items</span>, which should be a sequence of Components. The following keyword arguments may be used:</dd></dl><table style="text-align: left; margin-left: 80px;" border="0" cellpadding="4" cellspacing="0"><tbody><tr><td style="vertical-align: top; white-space: nowrap; text-align: left; font-family: monospace;">spacing = 10</td><td align="left" valign="top">Vertical space to leave between items.</td></tr><tr><td style="white-space: nowrap;"><span style="font-family: monospace;">padding = (0, 0)</span></td><td>Space to leave horizontally and vertically around all the items.</td></tr><tr><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top">align = 'l'</td><td align="left" valign="top">Specifies horizontal alignment and anchoring of items. One of <span style="font-family: monospace;">'l'</span>, <span style="font-family: monospace;">'c'</span>, <span style="font-family: monospace;">'r'</span> or <span style="font-family: monospace;">'lr'</span> for left, centre, right or left-and-right.</td></tr><tr><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top">equalize = ''</td><td style="vertical-align: top; text-align: left; width: 100%;">Specifies whether to make the size of all items equal in the horizontal and/or vertical direction. One of <span style="font-family: monospace;">'w'</span>, <span style="font-family: monospace;">'h'</span> or <span style="font-family: monospace;">'wh'</span>.</td></tr><tr><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top">expand = None</td><td style="vertical-align: top; text-align: left; width: 100%;">Specifies
which item, if any, is to change size vertically when the container is
resized. May be the item itself or an index into the item list. Items
above this item will be anchored to the top of the&nbsp;container, and
items below it will be anchored to the bottom of the&nbsp;container.<br><br>If specified by an index, the item at that index may be <span style="font-family: monospace;">None</span> to leave an expanding space in the column.</td></tr></tbody></table><br>---</body></html>

View File

@ -0,0 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>CommandSet</title></head><body><h1>class <span style="font-family: monospace;">CommandSet</span></h1>CommandSet
is a subclass of the built-in set type designed for representing a set
of command names, as used by the basic_menus() function. The following
additional features are provided.<br><ul><li>The constructor accepts a single item (a string) as well as a collection of items.</li><li>The + operator may be used as a synonym for | (set union).</li><li>Union and difference operations accept a string or sequence of strings as the other operand.</li></ul>---</body></html>

View File

@ -0,0 +1,160 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"><title>Component</title><!-- Changed by: Greg Ewing, 4-Aug-1998 -->
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<!-- Changed by: Greg Ewing, 3-Aug-1998 --> <h1>class <tt>Component(<a href="MessageHandler.html">MessageHandler</a>)</tt></h1>
<p>Component is an abstract base class representing a visual component of
the graphical user interface. A&nbsp;Component owns a rectangular region
of screen space defined by its <i>bounds</i> property. It may be contained
within another component, in which case it is clipped to the boundaries of
its container.<br>
</p>
<p>You should not derive directly from Component. Custom components should be based on a <a href="View.html">View</a> or <a href="Frame.html">Frame</a>.</p>
<h2>Geometry Properties</h2>
The geometry properties control the position and size of the component
within its container. There are several overlapping sets of geometry properties,
corresponding to different ways of defining the component's bounding rectangle.
The properties within each set are orthogonal, meaning that any one of
them may be changed without affecting the others.<br>
<dl>
<dl>
<dt><tt>bounds</tt></dt>
<dd>A rectangle (<i>left, top, right, bottom</i>) in the container's
coordinate system.<br>
</dd>
<dt><br>
</dt>
<dt><tt>left</tt></dt>
<dt><tt>top</tt></dt>
<dt><tt>right</tt></dt>
<dt><tt>bottom</tt></dt>
<dd>Each of these properties corresponds to one element of the bounds
rectangle. Changing one of these properties changes the position of one
edge of the component without affecting any of the others (and will consequently
change the width or height).<br>
</dd>
<dt><br>
</dt>
<dt><tt>x</tt></dt>
<dt><tt>y</tt></dt>
<dt><tt>width</tt></dt>
<dt><tt>height</tt></dt>
<dd>The <tt>x</tt> and <tt>y</tt> properties are the coordinates of the
top left corner of the component in its container's coordinate system.
Assigning to <tt>x</tt> or <tt>y</tt> will change the position of the component
within its container, but not its size.<br>
</dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>position</tt></dt>
<dt><tt>size</tt></dt>
<dd>The <tt>position</tt> property is equivalent to the tuple <tt>(x,
y)</tt>. The size property is equivalent to the tuple <tt>(width, height)</tt>.</dd>
</dl>
</dl>
<h2>Other Properties</h2>
<dl>
<dl>
<dt><tt>container</tt> </dt>
<dd>The Frame which contains this Component, if any. Setting this property
has the effect of removing the Component from the previous container and
adding it to the new container.<br><br></dd><dt style="font-family: monospace;"><a name="anchor"></a>anchor</dt><dd>This
property controls the layout behaviour of the component when its
container is resized. It is a string made up of the letters <span style="font-family: monospace;">'l'</span>, <span style="font-family: monospace;">'r'</span>, <span style="font-family: monospace;">'t'</span> and <span style="font-family: monospace;">'b'</span> for left, right, top and bottom.<br><br>If
the component is anchored to the left or top of its container, it
remains stationary when the container is resized. If it is anchored to
the right or bottom, it moves along with that side of the container. If
it is anchored to both left and right, or both top and bottom, it
stretches when the container is resized.</dd>
<dd><br>
</dd><dt><tt>border</tt></dt>
<dd>Setting this to true requests that the component be given a border.
The width and style of the border (or whether it even exists at all) is platform-dependent.
When the border is present, it is positioned around the outside of the component's
bounds rectangle, and is not included in the component's size.<br><br></dd><dt style="font-family: monospace;">tab_stop</dt><dd>A boolean indicating whether the component can be navigated into using the Tab key.<br><br>The default value of this property depends on the component's class, platform conventions and the setting of the <a href="navigation.html">PYGUI_KEYBOARD_NAVIGATION</a>
environment variable. For the standard control classes, you should
normally leave it set to the default value so as not to interfere with
the user's expectations. However, you may want to set it to false if
you provide some other way of invoking the control's function using the
keyboard.<br><br><span style="font-style: italic;">Note:</span> This
property is currently ignored for standard controls on MacOSX, where
the platform conventions and the user's System Preferences settings are
always followed.</dd>
</dl></dl>
<h2>Resizing Attributes</h2>
These attributes determine what happens to the container's position and
size when the size of its container changes as a result of the user resizing
the containing window, or a containing component's <tt>resize</tt> method
being called. These attributes are typically not set directly, but are established
by the container's <tt>place</tt> method when the component is added to
the container.<br>
<br>
<div style="margin-left: 40px;"><span style="font-style: italic;">NOTE: Because these are attributes and not properties, you can't set them using keyword arguments in the constructor.</span><br>
</div>
<dl>
<dl>
<dt><tt>hmove</tt> </dt>
<dd>If true, a change to the width of the container causes this component
to move horizontally by the same amount. </dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>vmove</tt> </dt>
<dd>If true, a change to the height of the container causes this component
to move vertically by the same amount. </dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>hstretch</tt> </dt>
<dd>If true, a change to the width of the container causes the width
of this component to change by the same amount. </dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>vstretch</tt></dt>
<dd>If true, a change to the&nbsp;height of the container causes the&nbsp;height
of this component to change by the same amount.</dd>
</dl>
</dl>
<h2>Methods</h2><blockquote><dl><dt><tt>become_target()</tt></dt>
<dd>Arranges for this&nbsp;component to have the first chance to handle
keystrokes, menu commands and other messages dispatched to the containing
window. If the component is not contained in a window, the effect is undefined.<br>
<br>
<span style="font-style: italic;">Note:</span> Depending on the
platform, not all components may be capable of becoming targets. This
method is only guaranteed to work on components which directly handle
input events. Its effect on other components is undefined.<br>
</dd>
</dl>
<dl>
<dt><tt>is_target()</tt></dt>
<dd>Returns true if this&nbsp;component is the current message target
within its containing window. If the component is not contained in a window,
the result is undefined.</dd>
</dl>
</blockquote><h2>Abstract methods</h2><dl style="margin-left: 40px;"><dt><tt>mouse_down(</tt><i>event</i><tt>)<br>mouse_drag</tt><tt>(</tt><i>event</i><tt>)</tt><br><tt>mouse_up</tt><tt>(</tt><i>event</i><tt>)</tt><br><tt>mouse_move</tt><tt>(</tt><i>event</i><tt>)</tt></dt><dd>These methods are called in response to mouse events occuring in the view. The position attribute
of the event contains the location of the mouse in local coordinates.</dd></dl><dl style="margin-left: 40px;"><dt><span style="font-family: monospace;"><a name="container_resized"></a>container_resized(</span><span style="font-style: italic;">delta</span><span style="font-family: monospace;">)</span></dt><dd>Called from the <a href="Container.html#resized"><span style="font-family: monospace;">resized()</span></a> method of the component's container. The delta parameter is a tuple <span style="font-style: italic;">(dx, dy)</span>
indicating the amount by which the container has changed size. The
default implementation updates the position and size of the component
according to its <a href="#anchor">resizing options</a>.</dd></dl><h2>Destructor</h2>
<dl>
<dl>
<dt><tt>destroy()</tt></dt>
<dd>Destroys the component and removes it from the screen. It should not
be used again.</dd>
</dl>
</dl>
<br>
<br>
<br>
<br>
</body></html>

View File

@ -0,0 +1,90 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"><title>Container</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<!-- Changed by: Greg Ewing, 9-Dec-1997 --> <h1>class <tt>Container(<a href="Component.html">Component</a>)</tt></h1>
<p>Container is an abstract base class for components which can contain other components. The contained
components are clipped to the boundary of their container.</p>
<p>The Container class provides a flexible placement facility for laying out
its contents and specifying how the contents behave when the container is resized.<br>
</p>
<p>You should not derive directly from Container. Custom components should be based on <a href="View.html">View</a> or <a href="Frame.html">Frame</a>.</p>
<h2>Properties</h2>
<blockquote> <dl>
<dt><tt>contents</tt></dt>
<dd>List of contained Components. <br>
<br>
</dd>
<dd><i>Do not modify the contents of this list directly.</i> Use the
placement methods, or the <tt>add</tt> and <tt>remove</tt> methods, to modify
the containment hierarchy.<br><br></dd><dt style="font-family: monospace;">content_width<br>content_height<br>content_size</dt><dd>The
size of the content area of the container. The content area is the area
available to subcomponents, excluding any borders, scrollbars or other
decorations that the component may have.<br><br></dd><dt style="font-family: monospace;"><a name="auto_layout"></a>auto_layout</dt><dd>A
boolean controlling whether the layout of subcomponents is
automatically adjusted when the container changes size. Defaults to
true.</dd>
</dl>
</blockquote>
<h2>Methods</h2>
<blockquote> <dl>
<dt><tt>add(</tt><i>component</i><tt>)</tt></dt>
<dd>Adds the given component to this container.</dd>
<dd><br>
</dd>
<dt><tt>remove(</tt><i>component</i><tt>)</tt></dt>
<dd>If the given component is among the contents of this container, removes
it.</dd>
<dd><br>
</dd>
<dt><tt>place(item,<br>
&nbsp; left = None, right = None, top = None, bottom = None,<br>
&nbsp; sticky = 'nw', scrolling = '', border = None)<br>
<br>
</tt></dt>
<dt><tt><a name="place_row"></a>place_row(items,<br>
&nbsp; left = None, right = None, top = None, bottom = None,<br>
&nbsp; sticky = 'nw', scrolling = '',border =&nbsp;</tt><tt>None</tt><tt>)<br>
<br>
</tt></dt>
<dt><tt><a name="place_column"></a>place_column(items,<br>
</tt><tt>&nbsp; left = None, right = None, top = None, bottom = None,<br>
</tt><tt>&nbsp; sticky = 'nw', scrolling = '', border =&nbsp;</tt><tt>None</tt><tt>)<br>
<br>
</tt></dt>
<dd>These methods add a component or list of components to the container with
the specified placement options. See <a href="place.html">Placement Methods</a>.</dd>
</dl>
</blockquote>
<blockquote>
<dl>
<dt><tt>shrink_wrap(padding</tt> <tt>=</tt> <tt>None</tt><tt>)</tt></dt>
<dd>Changes
the size of the container so that it neatly encloses its contents. By
default it leaves the same amount of space at the right and bottom of
the contents as there is at the left and top. This can be overridden by
specifying a tuple (<span style="font-style: italic;">right</span>, <span style="font-style: italic;">bottom</span>) for <span style="font-family: monospace;">padding</span>. If the container is empty, its size is not changed.</dd>
</dl></blockquote><blockquote>
<dl><dt><tt>resize(</tt><i>geometry_property</i> <tt>=</tt> <i>value</i><tt>,</tt>
...<tt>, auto_layout = False)</tt></dt><dd>This
method allows the size of the container to be changed without affecting
the layout of subcomponents. It is equivalent to assigning the given
values to the specified geometry properties, except that the <a href="#auto_layout"><span style="font-family: monospace;">auto_layout</span></a> property setting is temporarily overridden by the given parameter.</dd></dl></blockquote><h2>Callbacks</h2><dl style="margin-left: 40px;"><dt><span style="font-family: monospace;"><a name="resized"></a>resized(</span><span style="font-style: italic;">delta</span><span style="font-family: monospace;">)</span></dt><dd>Called when the size of the container changes for any reason while the <a href="#auto_layout"><span style="font-family: monospace;">auto_layout</span></a> property is true. The <span style="font-style: italic;">delta</span> parameter is a tuple <span style="font-style: italic;">(dx, dy)</span> representing the amount by which the size has changed. The default implementation calls <a href="Component.html#container_resized"><span style="font-family: monospace;">container_resized()</span></a> on each of the subcomponents.</dd></dl>
<h2>Destructor</h2>
<dl>
<dl>
<dt><tt>destroy()</tt></dt>
<dd>Destroys the container and all its contained subcomponents.</dd>
</dl>
</dl>
<p>---</p>
<br>
<br>
<br>
</body></html>

View File

@ -0,0 +1,40 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>PyGUI - class Control</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></head>
<body>
<h1>class <tt>Control(<a href="Component.html">Component</a>)</tt></h1>
Class Control is an abstract base class for controls. It provides a set of
properties that most controls have in common.<br>
<br>
Note that some platforms may not support changing all of these properties.<br>
<br>
You should not derive directly from Control. Custom components should be based on <a href="View.html">View</a> or <a href="Frame.html">Frame</a>.<br>
<h2>Properties</h2>
<blockquote>
<dl>
<dt style="font-family: monospace;">value</dt><dd>The value of the control. Its type depends on the kind of control.</dd><dt><tt>enabled</tt></dt>
<dd>True if the control can be manipulated by the user. Disabled controls
are typically displayed in a different way, and do not respond to user actions.</dd>
<dd><br>
</dd>
<dt><tt>font</tt></dt>
<dd>Font in which to display the control's title or text, if it has any.</dd>
<dd><br>
</dd>
<dt><tt>color</tt></dt>
<dd>Color in which to display the control's title or text, if it has
any.</dd>
<dd><br>
</dd>
<dt><tt>just</tt></dt>
<dd>Justification of the control's title or text, if it has any. One
of '<tt>left</tt>', '<tt>center</tt>' or '<tt>right</tt>'.</dd>
<dd><br>
</dd>
<dt><tt>lines</tt></dt>
<dd>The height of the control measured in lines of the current font.</dd>
</dl>
</blockquote>
<br>
</body></html>

View File

@ -0,0 +1,33 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - class Cursor</title></head>
<body>
<h1>class <span style="font-family: monospace;">Cursor</span></h1>
The Cursor class represents an image that may be used as a mouse cursor. A Cursor can be assigned to the <a href="ViewBase.html#cursor"><span style="font-family: monospace;">cursor</span></a>
property of a View to control the appearance of the cursor when the
mouse is over that view. A cursor can be obtained from a resource file,
constructed from an <a href="Image.html">Image</a>, or obtained from a set of predefined cursors in the <a href="StdCursors.html">StdCursors</a> module.<br>
<br>
The capabilites of cursors vary from one platform to another. There may
be a limit on the size of a cursor, and coloured cursors may or may not
be supported. For maximum portability, cursor images should be black
and white and no larger than 16x16 pixels.<br>
<h2>Constructors</h2>
<dl style="margin-left: 40px;">
<dt><span style="font-family: monospace;">Cursor(</span><span style="font-style: italic;">resource_name</span><span style="font-family: monospace;">,</span> <span style="font-style: italic;">hotspot</span> <span style="font-family: monospace;">=</span> <span style="font-family: monospace;">None)</span></dt><dd>Constructs a cursor from the specified resource, which should be an image file.</dd>
<dd><br>
</dd>
<dd>If no hotspot is specifed, a <span style="font-style: italic;">hotspot file</span> is searched for using the resource name with the suffix replaced by "<span style="font-family: monospace;">.hot</span>". The hotspot file should be a single-line text file containing two coordinates separated by whitespace.<br>
<br>
If no hotspot is specifed and no hotspot file is found, the hotspot defaults to the centre of the image.</dd>
<dt><br>
</dt>
<dt><span style="font-family: monospace;">Cursor(</span><span style="font-family: monospace;"></span><span style="font-style: italic;">image</span><span style="font-family: monospace;">,</span><span style="font-style: italic;"> hotspot</span> <span style="font-family: monospace;">=</span> <span style="font-family: monospace;">None)</span></dt>
<dd>Constructs a Cursor having the specified <a href="Image.html">Image</a>
and hotspot point. If the image has an alpha channel, it is used as the
cursor's mask. If no hotspot is specified, it defaults to the centre of
the image.<br>
</dd>
</dl>
<br>
</body></html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>Dialog</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></head>
<body>
<h1>class <tt>Dialog(<a href="Window.html">Window</a>)</tt></h1>
<br>
The Dialog class is a subclass of <a href="Window.html">Window</a> designed
for use as a dialog box. It provides facilities for defining default and
cancel buttons that are activated by keyboard equivalents.<br>
<br>
A Dialog differs from a Window in having a default style of <tt>'nonmodal_dialog'</tt>,
and by default (if possible on the platform) not being closable, zoomable
or resizable. These options can be overridden in the constructor call. <br>
<br>
On platforms which display a menu bar at the top of each window, a Dialog
does not normally have a menu bar. Enabled menu items are still available by their
keyboard equivalents while the Dialog is active, however.<br>
<h2>Constructor</h2>
<blockquote>
<dl>
<dt><tt>Dialog(style</tt> <tt>=</tt> <tt>'nonmodal_dialog',</tt></dt>
<dt><tt>&nbsp; &nbsp; &nbsp; &nbsp;</tt><tt>closable</tt> <tt>=</tt> <tt>False,</tt>
<tt>resizable</tt> <tt>=</tt> <tt>False,</tt> <tt>zoomable</tt> = <tt>False</tt><tt>,</tt></dt>
<dt><tt>&nbsp; &nbsp; &nbsp; &nbsp;movable</tt> <tt>=</tt> <i>platform_default</i><tt>,</tt> <tt>hidable</tt>
= <i>platform_default</i><tt>)<br></tt></dt>
<dd>Constructs a Dialog with the specified options. The default values
for the movable and hidable options are platform-dependent.</dd>
</dl>
</blockquote>
<h2>Action Properties</h2>
<blockquote>
<dl>
<dt><tt>default_action</tt></dt>
<dd><span style="font-family: monospace;"></span>Action
to perform in response to a Return or Enter key event. This action is
also typically invoked by activating a default button or pressing
Return or Enter in a text field. The default is <span style="font-family: monospace;">'ok'</span>, which is implemented by <a href="ModalDialog.html">ModalDialog</a> to dismiss the dialog with the value <span style="font-family: monospace;">True</span>. You can create a button which invokes this action using <a href="Button.html#DefaultButton">DefaultButton</a>.</dd></dl><dl><dt><tt>cancel_action</tt></dt>
<dd>Action to perform in response to an Escape key event.&nbsp;This action is also typically invoked by activating a cancel button or pressing Escape in a text field. The default is <span style="font-family: monospace;">'cancel'</span>, which is implemented by <a href="ModalDialog.html">ModalDialog</a> to dismiss the dialog with the value <span style="font-family: monospace;">False</span>. You can create a button which invokes this action using <a href="Button.html#CancelButton">CancelButton</a>.</dd>
</dl>
</blockquote>
<br>
<br>
</body></html>

View File

@ -0,0 +1,36 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - DirRef class</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>class <tt>Files.DirRef</tt></h1>
<p>A&nbsp;DirRef is a platform-independent representation of an existing directory. DirRef objects are immutable.<br>
</p>
<p>See also: <a href="FileRef.html">FileRef</a><br>
</p>
<h2>Constructor</h2>
<div style="margin-left: 40px;">
<dl>
<dt><span style="font-family: monospace;">DirRef(path</span> <span style="font-family: monospace;">=</span> string<span style="font-family: monospace;">)</span></dt>
<dd>Constructs a DirRef from a full pathname.<br>
<br>
Only the absolute pathname of an existing directory should be used. The
effect of a relative or nonexistent pathname, or the pathname of
something which is not a directory, is undefined.<br>
</dd>
</dl>
</div>
<h2>Properties</h2>
<div style="margin-left: 40px;">
<dl>
<dt style="font-family: monospace;">path</dt>
<dd><span style="font-style: italic;">Read only.</span> The full pathname of the directory.<br>
</dd>
</dl>
</div>
<p>---</p>
</body></html>

View File

@ -0,0 +1,67 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - GL.DisplayList</title></head>
<body>
<h1>class <span style="font-family: monospace;">GL.DisplayList</span></h1>
The DisplayList class in the GL submodule provides a context-independent
representation of an OpenGL display list. You can use a single DisplayList
object with multiple <a href="GLView.html">GLViews</a> and/or <a href="GLPixmap.html">GLPixmaps</a> without being concerned
whether they are sharing display list spaces or not, and without having to
keep track of OpenGL display list numbers.<br>
<br>
To use a DisplayList, you provide it with a <span style="font-style: italic;">setup function</span>
that makes the necessary OpenGL calls to define the display list. Then,
whenever you want to draw the display list, you call its <span style="font-family: monospace;">call</span>
method. Whenever the display list is used in a context where it has not
been used before, the setup function will be called to compile a
representation of it for that context.<br>
<br>
As an alternative to plugging in a setup function, you can also subclass DisplayList and override the <span style="font-family: monospace;">do_setup</span> method.<br>
<br>
Inside your setup function or method, you can freely make calls to draw other DisplayList and <a href="Texture.html">Texture</a>
objects, and PyGUI will make sure that everything is done in the right
order. To make this work, calls to the setup methods of those other
objects are deferred until definition of the first display list has
completed.<br>
<br>
<span style="font-style: italic;">Note:</span> If you make your own
calls to glNewList and glEndList, you must not attempt to use any
DisplayList or Texture objects between these calls, because PyGUI will
not know that a display list is being defined, and will try to do
things that don't work in that situation. Therefore it is recommended
that if you use these objects, you use them for <span style="font-style: italic;">all</span> of your display list and texure management.<br>
<h2>Constructor</h2>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">DisplayList(setup = None)</dt>
<dd>Constructs a new DisplayList with the given setup function. See the <span style="font-family: monospace;">setup</span> property.<br>
</dd>
</dl>
<h2>Properties</h2>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">setup</dt>
<dd>Function to define the contents of the display list. It should be
a callable object of no arguments. A call to glNewList will have been
made before the setup function is called, and glEndList will be called
after it returns.</dd>
</dl>
<h2>Methods</h2>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">call()</dt>
<dd>Call the display list, using glCallList. If the display list has
not previously been used with the current context (or one with which it
is sharing display lists), an OpenGL display list number is allocated
and the <span style="font-family: monospace;">setup</span> function is called to compile a representation of the display list.</dd>
</dl>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">deallocate()</dt><dd>Deallocates any OpenGL resources currently allocated to the DisplayList. If it is used again, new resources will be allocated.<br>
</dd>
</dl>
<h2>Abstract Methods</h2>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">do_setup()</dt>
<dd>As an alternative to supplying a setup function, a subclass can override this method to define the display list.</dd>
</dl>
--<br>
</body></html>

View File

@ -0,0 +1,116 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"><title>Document class</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>class <tt>Document(<a href="Model.html">Model</a>,</tt> <tt><a href="MessageHandler.html">MessageHandler</a>)</tt></h1>
<p>A Document represents an application data structure that can be stored
in a file. It implements standard functionality such as asking the user for
file names and opening and closing files.</p>
<p>Each Document can have one or more windows associated with it. When the
last window belonging to a document is closed, the document itself is closed.</p>
<p>A&nbsp;Document provides support for keeping track of whether it has been
edited, and asking the user whether to save changes when it is closed.</p>
<h2>Properties</h2>
<blockquote> <dl>
<dt><tt>needs_saving</tt></dt>
<dd>A boolean indicating that the document has been edited and needs
to be saved.</dd>
</dl>
<dl>
<dt><tt>file</tt></dt>
<dd>A <a href="FileRef.html">FileRef</a> identifying the file that the document was read from or
last written to, or None.</dd>
</dl>
<dl>
<dt style="font-family: monospace;">file_types</dt><dd>A list of <a href="FileType.html">FileType</a>
specifying the type of file read and written by the document. This may
be None if the document does not deal with files or does not care about
file types.<br><br>
</dd>
<dt><tt>title</tt></dt>
<dd>Document title to be displayed in window headers. The default value
of this property is derived from the last pathname component of the associated
file, or if the document is not associated with a file, a title such as "Untitled-<i>n</i>"
is constructed. Assigning to this property will cause all associated windows
to update their titles accordingly. &nbsp;</dd>
</dl>
<dl>
<dt><tt>windows</tt></dt>
<dd><i>Read-only.</i> List of windows associated with this document.<br><br></dd><dt style="font-family: monospace;">page_setup</dt><dd>A <a href="PageSetup.html">PageSetup</a> instance to be used by views having this document attached as a model.</dd>
</dl>
</blockquote>
<h2>Attributes</h2>
<blockquote> <dl>
<dt><tt>binary</tt></dt>
<dd>Determines the mode in which the file object passed to the <span style="font-family: monospace;">read_contents</span> and <span style="font-family: monospace;">write_contents</span>
methods is opened. If true, the file is opened in binary mode for
reading or writing. If false, the file is opened in text mode for
writing, and universal newlines mode for reading.<br>
</dd><dd><br>
</dd>
<dd>This attribute may be specified as a class attribute. The default value is <span style="font-style: italic;">true</span>.<br><br></dd><dt style="font-family: monospace;">pickle_as_parent_model</dt><dd><span style="font-style: italic;">(Read only)</span> This is set to <span style="font-family: monospace;">False</span> as a class attribute, and you should <span style="font-style: italic;">not</span> override it. Its purpose is to prevent the Document from being pickled along with a Model, as <a href="Model.html#pickle_parent">described here</a>.</dd></dl>
</blockquote>
<h2>Abstract Methods</h2>
<blockquote> <dl>
<dt><tt>new_contents()</tt></dt>
<dd>Should initialise the document to the appropriate state following
a <b>New </b>command.</dd>
</dl>
<dl></dl>
<dl>
<dt><tt>write_contents(file)</tt></dt>
<dd>Should write the document's contents to the given file, which is an already-open file object.</dd>
</dl>
<dl>
<dt><tt>read_contents(file)</tt></dt><dd>Should initialise the document's contents by reading it from the
given file, which is an already-open file object.<br><br>If you restore the contents by unpickling a previously-pickled <a href="Model.html">Model</a> whose <span style="font-family: monospace;">parent</span> attribute referred to the Document, you will need to re-set the parent here.<br><br></dd><dt><tt>destroy_contents()</tt></dt>
<dd>Called when the contents of the document are about to be discarded.
If the contents contains any Model objects, they should be destroyed.<br><br></dd><dt style="font-family: monospace;">get_default_save_directory()</dt><dd>Called
when the user is about to be asked for a location in which to save a
document that has not been saved before, to find a defaultdirectory for <a href="file_dialogs.html#request_new_file"><span style="font-family: monospace;">request_new_file()</span></a>. Should return a <a href="DirRef.html">DirRef</a> or <a href="FileRef.html">FileRef</a>, or <span style="font-family: monospace;">None</span> if there is no particular preferred location. The default implementation returns <span style="font-family: monospace;">None</span>.<br><br></dd><dt style="font-family: monospace;">get_default_save_filename()</dt><dd>Called when the user is about to be asked for a location in which to save a document that has not been saved before, to find a default file name for <a style="font-family: monospace;" href="file_dialogs.html#request_new_file">request_new_file()</a>. Should return a suggested file name, or an empty string to require the user to enter a file name. The default implementation returns an empty string.</dd>
</dl>
</blockquote>
<h2>Methods</h2>
<blockquote> <dl>
<dt><tt>changed()</tt></dt>
<dd>Mark the document as needing to be saved. Equivalent to setting the <tt>needs_saving</tt> property to true.</dd>
</dl>
<dl>
<dt><tt>save_changes()</tt></dt>
<dd>If the document has been edited, ask the user whether to save changes
and do so if requested.</dd>
</dl>
<dl>
<dt><tt>save_cmd()</tt></dt>
<dd>Implements the standard <b>Save</b> command. Writes the document
to its associated file, asking the user for one first if necessary.</dd>
</dl>
<dl>
<dt><tt>save_as_cmd()</tt></dt>
<dd>Implements the standard <b>Save As...</b> command. Asks the user
for a new file and writes the document to it.</dd>
</dl>
<dl>
<dt><tt>revert_cmd()</tt></dt>
<dd>Implements the standard <b>Revert </b>command. Discards the current
contents of the document and re-reads it from the associated file.</dd>
</dl>
<dl>
<dt><tt>close_cmd()</tt></dt>
<dd>Implements the standard <b>Close </b>command. Asks whether to save
any changes, then destroys any associated windows.<br><br></dd><dt style="font-family: monospace;">page_setup_cmd()</dt><dd>Default implementation of the <span style="font-weight: bold;">Page Setup...</span> command. Edits the <a href="PageSetup.html">PageSetup</a> instance referred to by the page_setup attribute. If it is None, a new PageSetup instance is created.</dd>
</dl>
</blockquote>
<h2>Destructor</h2>
<blockquote> <dl>
<dt><tt>destroy()</tt></dt>
<dd>Destroys any associated Windows, then destroys the Document.</dd>
</dl>
</blockquote>
<p>---</p>
<br>
<br>
</body></html>

164
PyGUI-2.5.3/Doc/Event.html Normal file
View File

@ -0,0 +1,164 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - class Event</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>class <tt>Event</tt> </h1>
<p>An Event object represents an input event such as a mouse click or keystroke.
</p>
<h2>Attributes </h2>
<blockquote> <dl>
<dt><tt>kind </tt></dt>
<dd>A code indicating the type of event. One of:<br>
<br>
</dd>
<dl>
<dl>
<li><tt>'mouse_down'</tt></li>
<li><tt>'mouse_drag'</tt></li>
<li><tt>'mouse_up'</tt></li><li><tt>'mouse_move'</tt></li><li><tt>'key_down'</tt></li>
<li><tt>'key_up'</tt> </li>
</dl>
</dl>
<dd>&nbsp;</dd>
<dt><tt>position </tt></dt>
<dd>For mouse events, the location of the mouse pointer when the event
occurred, in the coordinate system of the component receiving the event. For
mouse-down events, this is the component in which the click occurred. For
other mouse events, it is the view whose <tt>track_mouse</tt> method was
used to receive the event.&nbsp;<br></dd><dt style="font-family: monospace;">delta</dt><dd>For
mouse-move and mouse-drag events, a 2-tuple representing the relative
mouse motion since the last mouse event, unconstrained by screen
boundaries.<span style="font-style: italic;"> Currently implemented only on MacOSX.</span></dd>
<dd><br>
</dd>
<dt><tt>global_position</tt></dt>
<dd>The location in screen coordinates of the mouse pointer when the event
occurred. This attribute is valid for all event types.<br>
&nbsp;<br>
</dd>
<dt><tt>time</tt> </dt>
<dd>Time at which the event occurred. The origin and units are platform-dependent.<br>
&nbsp;</dd>
<dt><tt>num_clicks </tt></dt>
<dd>For mouse-down events, the number of clicks which have so far occurred
sufficiently close together in time and space to be considered a multiple
click.</dd>
<dd><br>
</dd>
<dt style="font-family: monospace;">button</dt><dd>For mouse-down and mouse-up events, the mouse button that caused the event. One of <span style="font-family: monospace;">'left'</span>, <span style="font-family: monospace;">'middle'</span> or <span style="font-family: monospace;">'right'</span>.</dd><dd><br>
</dd>
<dd>
<div style="margin-left: 40px;"><span style="font-weight: bold;">NOTE</span>:
Portable applications should not rely on all of these values being
available. Some platforms have only 2 buttons (e.g. Windows) or 1
button (e.g. Macintosh). You should provide alternative ways of
invoking middle and right mouse button functions if you want your
application to be usable on these platforms.<br>
</div>
<br>
</dd>
<dt><tt>char</tt></dt>
<dd>For key-down and key-up events, the ASCII character corresponding
to the key. If the key is not associated with a character, or the character cannot be represented in ASCII, this is
an empty string.<br><br></dd><dt style="font-family: monospace;">unichars</dt><dd>For key-down and key-up events,&nbsp;a Unicode string representing the textual value of the key, if any.</dd>
</dl>
<dl>
<dt><tt>key</tt></dt>
<dd>For keys which do not have an ASCII character, and certain other special keys, this is a string naming
the key. It may have the following values:</dd>
</dl>
<table align="center" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td><tt>'left_arrow'<br>
'right_arrow'<br>
'up_arrow'<br>
'down_arrow'<br>'return'<br>
'enter'<br>
'f1' to 'f15'<br>
</tt></td>
<td valign="top" width="20"><br>
</td>
<td valign="top"><tt>'insert'<br></tt><tt>'delete'<br>
</tt><tt>'home'<br>
'end'<br>
'page_up'<br>
'page_down'<br>
</tt></td>
</tr>
</tbody>
</table>
<dl>
</dl>
<dl>
<dd><span style="font-weight: bold;">Note:</span> The Return key on the main keyboard and the Enter key on the numeric keypad both set the <span style="font-family: monospace;">char</span> attribute to <span style="font-family: monospace;">'\r'</span>. They are distinguished by the <span style="font-family: monospace;">key</span> attribute being set to <span style="font-family: monospace;">'return'</span> for the Return key and <span style="font-family: monospace;">'enter'</span> for the Enter key. (On most PC keyboards, both of these keys are marked "Enter", but the same behaviour applies.)<br><br><span style="font-weight: bold;">Note:</span> On Macintosh keyboards, the <span style="font-family: monospace;">insert</span> key is labelled "Help".<br><br><span style="font-weight: bold;">Note:</span>
On the Macintosh, keystrokes with the Option key produce accented
characters and other special symbols which cannot be represented in
ASCII; for these, the <span style="font-family: monospace;">char</span> attribute will be empty. The <span style="font-family: monospace;">unichars</span> attribute may be used to find the Unicode value for these characters, and the <span style="font-family: monospace;">key</span> attribute will contain an ASCII string identifying the keyboard key that was pressed. For example, Option-a produces <span style="font-family: monospace;">unichars = u'\xe5'</span> and <span style="font-family: monospace;">key = 'a'</span>.</dd>
</dl>
<dl>
<dt><tt>auto</tt></dt>
<dd>For key-down events, and on platforms which support it, a boolean
indicating that the event is due to an auto-repeating key rather than a physical
keystroke.<br>
</dd>
</dl>
</blockquote>
<h2>Modifier Attributes </h2>
<p>The following attributes are boolean values indicating the state of mouse
buttons and/or keyboard modifier keys at the time of the event.<br>
</p>
<p>There are two groups of modifiers, high-level and low-level. The high-level
modifiers are abstract and are mapped onto the available keys and buttons
in a platform-dependent way. The low-level modifiers, on the other hand,
represent physical keys.<br>
</p>
<p>Some of the high-level modifiers may be defined in terms of the low-level
modifiers, so the programmer should not rely on all possible combinations
of modifiers being distinguishable. Modifiers within each group, however,
should always be independent of each other. </p>
<p>The high-level modifiers are: </p>
<dl>
<dl>
<dt><tt>extend_contig </tt></dt>
<dt><tt>extend_noncontig </tt></dt>
<dd>These indicate that a selection is to be extended contiguously or
non-contiguously. If neither of these is true, a new selection is to be begun
or an existing selection deselected. </dd>
<dd>&nbsp;</dd>
<dt><tt>option </tt></dt>
<dd>This is a general-purpose modifier whose interpretation is up to the
programmer. </dd>
</dl>
</dl>
<p>The low-level modifiers are: </p>
<dl>
<dl>
<dt><tt>shift </tt></dt>
<dt><tt>control </tt></dt>
<dd>These represent the state of the shift and control keys on the keyboard.
They ought to be available on most platforms, although there may be exceptions
(early Macintosh keyboards, for example, had no Control key). </dd>
</dl>
</dl>
<h2>Methods</h2>
<blockquote> <dl>
<dt><tt>position_in(</tt><i>view</i><tt>)</tt></dt>
<dd>Returns the location of the event in the coordinate system of the
specified view.</dd>
</dl>
</blockquote>
<br>
<br>
<br>
</body></html>

View File

@ -0,0 +1,46 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - Exception classes</title></head><body>
<h1>Exception classes</h1>
PyGUI defines the following exception classes for use by application code.<br>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">Cancel</dt>
<dd><br>
This exception can be raised to abort an operation, such as in response
to the user clicking a Cancel button. It is silently caught by the main
event loop.<br>
<br>
When writing code, you should keep the possibility of Cancel exceptions
in mind, and make judicious use of try-finally to clean up after
operations that could be cancelled part way through.<br>
<br>
</dd>
<dt><span style="font-family: monospace;">ApplicationError(</span><span style="font-style: italic;">message</span> [, <span style="font-style: italic;">detail</span>]<span style="font-family: monospace;">)</span><br>
</dt>
<dd><br>
This exception can be raised to signal an error that should be reported
to the user. It is caught by the main event loop and a suitable alert
displayed.<br>
<br>
The <span style="font-style: italic;">message</span> should be a brief description of the error, including primary relevant information. The <span style="font-style: italic;">detail</span> may be a longer discourse providing further information about the cause of the error and/or possible remedies. For example,<br>
<br>
<div style="margin-left: 40px;">
<dl>
<dt>message:</dt>
</dl>
</div>
</dd>
<dd>
<div style="margin-left: 40px;">
<dl>
<dd>"Unable to open the file 'InterestingStuff.txt'".</dd>
</dl>
<br>
<dl>
<dt>detail:</dt>
<dd>"Someone has spread peanut butter on the disk. Please clean it and try again."</dd>
</dl>
</div>
</dd>
</dl>
---<br>
</body></html>

View File

@ -0,0 +1,82 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - FileRef class</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>class <tt>Files.FileRef</tt></h1>
<p>A&nbsp;FileRef is a platform-independent representation of a file system object. It consists of two parts, a <span style="font-style: italic;">directory specification</span> and the <span style="font-style: italic;">name</span> of an object within that directory.</p>
<p>A FileRef may name an existing object or one that does not yet
exist. The directory specification always refers to an existing
directory, however (although this is not necessarily enforced).<br>
</p>
<p>When using a pathname in the construction of a FileRef, an absolute
pathname should be used. The effect of specifying a relative pathname
is undefined.<br>
</p>
<p>FileRef objects are immutable.<br>
</p>
<h2>Constructors</h2>
<div style="margin-left: 40px;">
<dl>
<dt><span style="font-family: monospace;">FileRef(dir</span> <span style="font-family: monospace;">=</span> <a href="DirRef.html">DirRef</a> or path, <span style="font-family: monospace;">name</span> <span style="font-family: monospace;">=</span> string<span style="font-family: monospace;">)</span></dt>
<dd>Constructs a FileRef from a directory specification and a name
within that directory. The directory may be specified either by a full
pathname or a DirRef.<br>
<br>
</dd>
<dt><span style="font-family: monospace;">FileRef(path</span> <span style="font-family: monospace;">=</span> string<span style="font-family: monospace;">)</span></dt>
<dd>Constructs a FileRef from a full pathname.<br>
</dd>
</dl>
</div>
<h2>Properties</h2>
<dl>
<dl>
<dt><tt>name</tt></dt>
<dd><span style="font-style: italic;">Read only. </span>Name of the object within its parent directory.<br>
</dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>dir</tt></dt>
<dd><span style="font-style: italic;">Read only.&nbsp; </span>A&nbsp;<a href="DirRef.html">DirRef</a> representing the directory
in which the object resides, or will reside in the case of an object which does
not yet exist.</dd>
</dl>
</dl>
<h2>Methods</h2>
<dl>
<dl>
<dt><tt><a name="open"></a>open(mode, file_type = None)</tt></dt>
<dd>Opens the referenced object as a file using the given <i>mode </i>(which is the
same as the <i>mode </i>parameter to the built-in <tt>open</tt> function).
If opening for writing and the file does not yet exist, it is created.<br>
<br>
If <span style="font-style: italic;">file_type</span> is given, it should be a <a href="FileType.html">FileType</a>
instance specifying the file type metadata to be attached to the file.
This parameter is only used if the call results in the creation of a
new file. On platforms which do not have file type metadata, it is
ignored.<br>
<br>
</dd><dt style="font-family: monospace;">mkdir()</dt>
<dd>Creates a directory with the name and parent directory specified by the FileRef. Returns a <a href="DirRef.html">DirRef</a> representing the created directory.<br>
</dd>
</dl>
</dl>
<p>---</p>
</body></html>

View File

@ -0,0 +1,68 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - FileType class</title></head>
<body>
<h1>class <span style="font-family: monospace;">Files.FileType</span></h1>
The FileType class provides a multi-platform representation of a file
type, holding the metadata used by the various platforms to create and
recognise files of a particular type. FileType instances are used by
the <a href="file_dialogs.html">standard file selection dialogs</a> to restrict the set of selectable files, and by the <a href="FileRef.html">FileRef</a> class to enable creating a file of a
specified type.<br>
<h2>Properties</h2>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">name</dt><dd>A short human-readable description of the file type.<br>
<br>
</dd>
<dt><span style="font-family: monospace;">suffix</span></dt>
<dd>Filename suffix (without dot) used to recognise files of this
type. This is the most generic way of specifying a file type, as it
works across most platforms.</dd><dd><br>
</dd>
<dd>This property is used by <a href="file_dialogs.html#request_old_file">request_old_file()</a> to filter the set of files that can be selected, and by <a href="file_dialogs.html#request_new_file">request_new_file()</a> to determine the suffix of the returned filename. Note, however, that it is ignored by <a href="FileRef.html#open">FileRef.open()</a>
when creating a file. If you use a filename other than one returned by
request_new_file(),&nbsp; it is your responsibility to add any
necessary suffix.<br>
<br>
</dd>
<dt><span style="font-family: monospace;">mac_creator</span></dt>
<dd>On the Macintosh, the 4-character creator code to be given to
newly-created files of this type. This property is used by <a href="FileRef.html#open">FileRef.open()</a> when creating a file, but not by the file dialog functions.</dd><dd><br>
On other platforms, this property is ignored.<br>
<br>
</dd>
<dt><span style="font-family: monospace;">mac_type</span></dt>
<dd>On the Macintosh, the 4-character type code. This property is
used by <a href="FileRef.html#open">FileRef.open()</a> when creating a file, and by <a href="file_dialogs.html#request_old_file">request_old_file()</a> to filter the set of files that can be selected.<br>
<br>
On other platforms, this property is ignored.<br>
<br>
</dd><dt style="font-family: monospace;">mac_force_suffix</dt>
<dd>On MacOSX, this property controls whether files saved as this type are forced to have the specified suffix even when a <span style="font-family: monospace;">mac_type</span>
is specified. The default is true, which ensures that the application
will always recognise saved files as being of this type on all
platforms.<br>
<br>
By specifying a mac_type and setting this property to false, you can
allow files to be saved on the Macintosh with any file name. On the
Macintosh their type will be recognised by the mac_type, and files
saved on other platforms will be recognised by their suffix. However,
to ensure that files saved on the Macintosh will be recognised on other
platforms, you will need to manually give them the correct suffix.<br>
<br>
This property only applies when the file type specifies both a suffix
and a mac_type. When there is no mac_type, the suffix is always
enforced. When there is no suffix, this property is ignored (since
there is no suffix to enforce).<br>
<br>
On non-Macintosh platforms, this property is ignored, and the suffix, if any, is always enforced.<br>
</dd>
</dl>---<br>
</body></html>

70
PyGUI-2.5.3/Doc/Font.html Normal file
View File

@ -0,0 +1,70 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - class Font</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>class <tt>Font</tt> </h1>
<p>A Font object represents a set of characters of a particular typeface,
style and size. Font objects are immutable. </p>
<h2>Constructor </h2>
<dl>
<dl>
<dt><tt>Font(family</tt><tt>, size</tt><tt>, style) </tt></dt>
<dd>The family is the name of a font family ("Times", "Helvetica", etc...).
The size is measured in points.
The style is a list of zero or more of: <tt>'bold'</tt>, <tt>'italic'</tt>. </dd>
</dl>
</dl>
<h2>Properties </h2>
<dl>
<dl>
<dt><tt>family</tt></dt>
<dd><i>Read-only.</i> Family name of the font.</dd>
<dd><tt><br>
</tt></dd>
<dt><tt>style</tt></dt>
<dd><i>Read-only.</i> Style of the font.</dd>
<dd><br>
</dd>
<dt><tt>size</tt></dt>
<dd><i>Read-only.</i> Point size of the font.</dd>
<dd><br>
</dd>
<dt><tt>ascent</tt></dt>
<dd><i>Read-only.</i> Distance from the baseline of the font to the top
of the tallest character.</dd>
<dd><br>
</dd>
<dt><tt>descent </tt></dt>
<dd><i>Read-only.</i> Distance from the baseline of the font to the bottom
of the lowest character.</dd>
<dd><br>
</dd>
<dt><tt>height</tt></dt>
<dd><i>Read-only.</i> Height of the font (equal to ascent +
descent).<br><br>
</dd><dt style="font-family: monospace;">leading</dt><dd><span style="font-style: italic;">Read-only.</span> Recommended space to leave between adjacent lines of text.<br><br></dd><dt style="font-family: monospace;">line_height</dt>
<dd><span style="font-style: italic;">Read-only.</span> Recommended distance between the baselines of adjacent lines of text (equal to ascent + descent + leading).<br><br></dd><dt style="font-family: monospace;">cap_height</dt><dd><span style="font-style: italic;">Read-only. </span>Height above the baseline of capital letters. May not be accurate on all platforms.<br><br></dd><dt style="font-family: monospace;">x_height</dt><dd><span style="font-style: italic;">Read-only. </span>Height above the baseline of lower case letters without ascenders. May not be accurate on all platforms.</dd>
</dl>
</dl>
<h2>&nbsp;Methods</h2>
<dl>
<dl>
<dt><tt>width(string [,start [,end]]) </tt></dt>
<dd>Returns the width of the specified part of the given string when
drawn in this font. </dd>
</dl>
</dl>
<h2>Constants</h2>
<dl>
<dt><tt>system_font</tt></dt>
<dt><tt>application_font</tt></dt>
<dd>Predefined Font instances representing the standard fonts for system
text and application text, respectively.</dd>
</dl>
<br>
<br>
<br>
<br>
</body></html>

View File

@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - Frame class</title></head><body>
<h1>class Frame(<a href="Container.html">Container</a>)</h1>
Frame is an instantiable subclass of Container that you can use as a general-purpose container of other components.<br>
<br>
---<br>
<br>
</body></html>

44
PyGUI-2.5.3/Doc/GL.html Normal file
View File

@ -0,0 +1,44 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - GL module</title></head>
<body>
<h1>Module <span style="font-family: monospace;">GL</span></h1>
The GL submodule provides a number of facilities for using OpenGL
graphics in PyGUI applications. Use of these requires the presence of a
functioning PyOpenGL installation.<br>
<h2>Classes</h2>
The following classes are defined in the GL submodule.<br>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;"><a href="GLConfig.html">GLConfig</a></dt>
<dd>A bundle of OpenGL context attributes.<br>
<br>
</dd>
<dt style="font-family: monospace;"><a href="GLView.html">GLView</a></dt>
<dd>An on-screen view for displaying OpenGL graphics.<br>
<br>
</dd>
<dt style="font-family: monospace;"><a href="GLPixmap.html">GLPixmap</a></dt>
<dd>An off-screen area for OpenGL graphics.<br>
<br>
</dd><dt style="font-family: monospace;"><a href="ShareGroup.html">ShareGroup</a></dt>
<dd>A group of OpenGL contexts sharing textures and display lists.<br>
</dd>
</dl>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;"><a href="Texture.html">Texture</a></dt>
<dd>A context-independent representation of an OpenGL texture.<br>
<br>
</dd><dt style="font-family: monospace;"><a href="DisplayList.html">DisplayList</a></dt>
<dd>A context-independent representation of an OpenGL display list.<br>
</dd>
</dl>
<h2>Exceptions</h2>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">GLConfigError</dt>
<dd>Raised when attempting to construct a GLView or GLPixmap with a set of attributes that cannot be satisified.</dd>
</dl>
<br>
<br>
</body></html>

View File

@ -0,0 +1,79 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - GLConfig class</title></head>
<body>
<h1>class <span style="font-family: monospace;">GL.GLConfig</span></h1>
The GLConfig class of the GL submodule provides a bundle of attributes
for configuring an OpenGL context. It also provides facilities for
testing whether a given set of attributes is supported and finding out
what attributes are supported on the platform where the application is
running.<br>
<h2>Properties</h2>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">double_buffer</dt>
<dd>True if double buffering is desired.<br>
<br>
</dd>
<dt style="font-family: monospace;">alpha</dt>
<dd>True if an alpha channel is required.<br>
<br>
</dd>
<dt style="font-family: monospace;">color_size</dt>
<dd>Desired number of bits per color buffer component.<br>
<br>
</dd>
<dt style="font-family: monospace;">alpha_size</dt>
<dd>Desired number of bits per alpha channel component.<br>
<br>
</dd>
<dt style="font-family: monospace;">stereo</dt>
<dd>True if a stereoscopic context is required.<br>
<br>
</dd>
<dt style="font-family: monospace;">aux_buffers</dt>
<dd>Number of auxiliary buffers required.<br>
<br>
</dd>
<dt style="font-family: monospace;">depth_buffer</dt>
<dd>True if a depth buffer is required.<br>
<br>
</dd>
<dt style="font-family: monospace;">depth_size</dt>
<dd>Desired number of bits per depth buffer element.<br>
<br>
</dd>
<dt style="font-family: monospace;">stencil_buffer</dt>
<dd>True if a stencil buffer is required.<br>
<br>
</dd>
<dt style="font-family: monospace;">stencil_size</dt>
<dd>Desired number of bits per stencil buffer element.<br>
<br>
</dd>
<dt style="font-family: monospace;">accum_buffer</dt>
<dd>True if an accumulation buffer is required.<br>
<br>
</dd>
<dt style="font-family: monospace;">accum_size</dt>
<dd>Desired number of bits per accumulation buffer element.<br>
<br>
</dd>
<dt style="font-family: monospace;">multisample</dt>
<dd>True if a multisampled context is desired.<br>
<br>
</dd>
<dt style="font-family: monospace;">samples_per_pixel</dt>
<dd>Desired number of samples per pixel when multisampling is active.<br>
</dd>
</dl>
<h2>Methods</h2>
<div style="margin-left: 40px;">
<dl>
<dt style="font-family: monospace;">supported(mode = 'both')</dt>
<dd>Tests whether the requested combination of attributes, or
something close to them, can be satisfied. If successful, a new
GLConfig instance is returned whose attributes reflect those actually
available. Otherwise, None is returned.<br><br>The <span style="font-family: monospace;">mode</span> parameter may be <span style="font-family: monospace;">'screen'</span>, <span style="font-family: monospace;">'pixmap'</span> or <span style="font-family: monospace;">'both'</span> to request a configuration suitable for drawing to a GLView, a GLPixmap, or both a GLView and a GLPixmap.</dd>
</dl>
</div>
<br>
</body></html>

View File

@ -0,0 +1,34 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - GLPixmap class</title></head>
<body>
<h1>class <span style="font-family: monospace;">GL.GLPixmap(<a href="ImageBase.html">ImageBase</a>)</span></h1>
The GLPixmap class in the GL submodule provides an off-screen area for
OpenGL drawing that may subsequently be used as a 2D image and drawn
into a Canvas.<br>
<h2>Constructors</h2>
<dl style="margin-left: 40px;">
<dt><tt>GLPixmap(width,</tt> <tt>height,</tt> <tt>config,</tt> <tt>share_group</tt> <tt>=</tt> <tt>None)</tt><span style="font-family: monospace;"><br>
</span><tt>GLPixmap</tt><span style="font-family: monospace;">(</span><tt>width,</tt> <tt>height</tt><span style="font-family: monospace;">,</span><span style="font-style: italic;"> config_attr</span> = <span style="font-style: italic;">value...</span><tt>,</tt><span style="font-family: monospace;"> share_group</span> <span style="font-family: monospace;">=</span> <span style="font-family: monospace;">None</span><span style="font-family: monospace;">)</span></dt>
<dd>Creates a GLPixmap having the given size and characteristics.
In the first form of the constructor, the characteristics are specified
by a <a href="GLConfig.html">GLConfig</a> instance. In the second form, attributes of the GLConfig
class are specified as individual keyword arguments to the constructor.<br>
<br>
If <span style="font-style: italic;">share_group</span> is specified, it should be a <a href="ShareGroup.html">ShareGroup</a> instance,&nbsp;and the GLPixmap is added to that group.</dd>
</dl>
<h2>Abstract methods</h2>
<blockquote> <dl><dt><tt>init_context()</tt></dt><dd>Immediately after the view's OpenGL context is created, it is made
the current context and this method is called. You may use this method to
establish any desired initial OpenGL state.</dd></dl>
</blockquote>
<h2>Methods</h2>
<dl style="margin-left: 40px;">
<dt><tt>with_context(</tt><i>function</i><tt>,</tt> <tt>flush</tt> <tt>=</tt> <tt>True)</tt></dt><dd>The&nbsp;<i>function</i> should be a callable object of no arguments.
Calls&nbsp;<i>function</i> with the pixmap's OpenGL context as the current context. If <span style="font-style: italic;">flush</span> is true, then after calling the function, a buffer flush or swap is performed as appropriate.</dd>
</dl>
---<br>
</body></html>

102
PyGUI-2.5.3/Doc/GLView.html Normal file
View File

@ -0,0 +1,102 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>PyGUI - GLView</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<h1>class <tt>GL.GLView(Component,</tt> <tt>ViewBase)</tt></h1>
The <tt>GLView</tt> class of the <tt>GL</tt>
submodule provides an area for displaying 3D graphics using OpenGL. It
also provides model observation and input handling facilities via the <a href="ViewBase.html">ViewBase</a> class.<br>
<h2>Constructors</h2>
<blockquote>
<dl>
<dt><tt>GLView(config,</tt> <tt>share_group</tt>
<tt>=</tt> <tt>None)</tt></dt>
<span style="font-family: monospace;">GLView(</span><span style="font-style: italic;">config_attr</span> = <span style="font-style: italic;">value...</span><span style="font-family: monospace;">, share_group = None)</span><br>
<dd>Creates a GLView having the given characteristics.
In the first form of the constructor, the characteristics are specified
by a <a href="GLConfig.html">GLConfig</a> instance.
In the second form, attributes of the GLConfig
class are specified as individual keyword arguments to the constructor.<br>
</dd>
<dt><br>
</dt>
<dd>If <span style="font-style: italic;">share_group</span>
is specified, it should be a <a href="ShareGroup.html">ShareGroup</a>
instance, and the GLView is added to that group.</dd>
</dl>
</blockquote>
<h2>Abstract methods</h2>
<blockquote>
<dl>
<dt><tt>init_context()</tt></dt>
<dd>Immediately after the view's OpenGL context is created,
it is made the current context and this method is called. You may use
this method to establish any desired initial OpenGL state.<br>
<br>
</dd>
<dt style="font-family: monospace;">init_projection()</dt>
<dd>You may use this method to establish the desired
projection matrix. It is called after <tt>init_context()</tt>
during creation of the GLView, and again whenever the size of the view
changes. When called, the view's OpenGL context is the current context,
and its viewport has been set to (0, 0, <i>w</i>,<i>
h</i>) where (<i>w</i>, <i>h</i>) is the
new
size of the view. Also, the projection matrix has been selected as the
current matrix and loaded with an identity matrix. In most cases, you
will simply need to call either gluPesrpective() or gluOrtho() to set
up the projection.</dd>
</dl>
</blockquote>
<blockquote>
<dl>
<dt><tt>render()</tt></dt>
<dd>This method is called with the view's OpenGL context as
the current context whenever the view needs to be redrawn. The
modelview matrix has been selected and loaded with an identity matrix.
On return, drawing will be flushed and buffers swapped as appropriate.<br>
</dd>
</dl>
<dl>
<dt><tt>viewport_changed()</tt></dt>
<dd>This
is a lower-level method that is called when the size of the view
changes, after setting the viewport but before doing anything else. The
default implementation calls <span style="font-family: monospace;">init_projection()</span>.
You will not usually need to override this method.</dd>
</dl>
</blockquote>
<h2>Methods</h2>
<blockquote>
<dl>
<dt><tt>with_context(</tt><i>function</i><tt>,</tt>
<tt>flush</tt> <tt>=</tt> <tt>True)</tt></dt>
<dd>The&nbsp;<i>function</i> should be a
callable object of no arguments. Calls&nbsp;<i>function</i>
with the view's OpenGL context as the current context. If <span style="font-style: italic;">flush</span> is true, then
after calling the function, a buffer flush or swap is performed as
appropriate.<br>
</dd>
</dl>
<dl>
<dt><tt>invalidate()</tt></dt>
<dd>Marks the whole view as needing to be redrawn.</dd>
</dl>
</blockquote>
<blockquote>
<dl>
<dt><tt>update()</tt></dt>
<dd>Causes the whole view to be redrawn immediately, without
waiting
for a return to the event loop.<br>
</dd>
</dl>
</blockquote>
---<br>
<br>
<br>
</body></html>

View File

@ -0,0 +1,86 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>PyGUI - Geometry submodule</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></head>
<body>
<h1><tt>Geometry</tt> submodule</h1>
The Geometry submodule provides a collection of functions for operating
on points and rectangles. See the section on <a href="coordinates.html">Coordinates,
Points and Rectangles</a> for a discussion of how these entities are defined.<br>
<h2>Point functions</h2>
<dl>
<dt><tt>add_pt(</tt><i>p1, p2</i><tt>)</tt></dt>
<dd>Returns the point resulting from adding the coordinates of points <i>p1</i> and <i>p2</i>.</dd>
</dl>
<dl>
<dt><tt>sub_pt(</tt><i>p1, p2</i><tt>)</tt></dt>
<dd>Returns the point resulting from subtracting the coordinates of point
<i>p2</i> from those of point <i>p1</i>.</dd>
</dl>
<h2>Rectangle functions</h2>
<dl>
<dt><tt>rect_sized(</tt><i>p, size</i><tt>)</tt></dt>
<dd>Returns a rectangle of the specified size with <i>p</i> as its top left
corner.</dd>
</dl>
<dl>
<dt><tt>rect_left(</tt><i>r</i><tt>)</tt></dt>
<dt><tt>rect_top(</tt><i>r</i><tt>)</tt></dt>
<dt><tt>rect_right(</tt><i>r</i><tt>)</tt></dt>
<dt><tt>rect_bottom(</tt><i>r</i><tt>)</tt></dt>
<dd>These functions return the left, top, right or bottom coordinate, respectively,
of the given rectangle.</dd>
</dl>
<dl>
<dt><tt>rect_width(</tt><i>r</i><tt>)</tt></dt>
<dt><tt>rect_height(</tt><i>r</i><tt>)</tt></dt>
<dd>These functions return the width or height, respectively, of the given
rectangle.</dd>
</dl>
<dl>
<dt><tt>rect_topleft(</tt><i>r</i><tt>)</tt></dt>
<dt><tt>rect_botright(</tt><i>r</i><tt>)</tt></dt>
<dd>These functions return the top left or bottom right point, respectively,
of the given rectangle.</dd>
</dl>
<dl>
<dt><tt>rect_size(</tt><i>r</i><tt>)</tt></dt>
<dd>Returns the size of the given rectangle.</dd>
</dl>
<dl>
<dt><tt>union_rect(</tt><i>r1, r2</i>)</dt>
<dd>Returns the union of the rectangles <i>r1</i> and <i>r2</i>, i.e. the
smallest rectangle enclosing both <i>r1</i> and <i>r2</i>.</dd>
</dl>
<dl>
<dt><tt>sect_rect(</tt><i>r1, r2</i><tt>)</tt></dt>
<dd>Returns the intersection of rectangles <i>r1</i> and <i>r2</i>.</dd>
</dl>
<dl>
<dt><tt>inset_rect(</tt><i>r, </i><tt>(</tt><i>dx, dy</i><tt>))</tt></dt>
<dd>Returns the rectangle resulting from displacing the sides of the rectangle
<i>r</i> inwards horizontally by <i>dx</i> and vertically by <i>dy</i>.</dd>
</dl>
<dl>
<dt><tt>offset_rect(</tt><i>r,&nbsp;</i><tt>(</tt><i>dx, dy</i><tt>)</tt><tt>)</tt></dt>
<dd>Returns the rectangle resulting from displacing the rectangle <i>r</i> horizontally by <i>dx</i> and vertically by <i>dy</i>.</dd>
</dl>
<dl>
<dt><tt>empty_rect(</tt><i>r</i><tt>)</tt></dt>
<dd>Returns true if <i>r</i> is an empty rectangle.</dd>
</dl>
<dl>
<dt><tt>pt_in_rect(</tt><i>p, r</i><tt>)</tt></dt>
<dd>Returns true if the point <i>p</i> is in the rectangle <i>r</i>. A point
is considered to be in a rectangle if the pixel immediately below and to
the right of the point is enclosed by the rectangle.<br>
<br>
</dd><dt><span style="font-family: monospace;">rects_intersect(</span><span style="font-style: italic;">r1</span>, <span style="font-style: italic;">r2</span><span style="font-family: monospace;">)</span></dt>
<dd>Returns true if the intersection of rectangles <span style="font-style: italic;">r1</span> and <span style="font-style: italic;">r2</span> is nonempty.<br>
</dd>
</dl>
---<br>
<br>
</body></html>

13
PyGUI-2.5.3/Doc/Grid.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>Grid class</title></head>
<body><h1>class <span style="font-family: monospace;">Grid(<a href="Frame.html">Frame</a>)</span></h1>A Grid is a container that lays out a collection of components in a two-dimensional grid.<br><br>The
initial size of the container, and the width of each column and height
of each row, are made just large enough to hold their contents. The
horizontal and vertical alignment of components within their cells can
be specified. One row and/or one column may be specified to expand when the Grid is resized.<br><br>In addition, the width and/or height of all items may optionally be equalized before they are laid out.<br><br><i>Note: Don't confuse this with the <a href="GridView.html">GridView</a> class, which is a view providing a regular grid of user-drawn cells.</i><br><h2>Constructor</h2><dl style="margin-left: 40px;"><dt><span style="font-family: monospace;">Grid(</span><span style="font-style: italic;">items</span>, <span style="font-style: italic;">keyword</span> <span style="font-family: monospace;">=</span> <span style="font-style: italic;">value</span><span style="font-family: monospace;">,</span> ...<span style="font-family: monospace;">)</span></dt><dd>Creates a Grid containing the specified <span style="font-style: italic;">items</span>, which should be a sequence of rows, each of which is a sequence of Components. An item may be <span style="font-family: monospace;">None</span> to leave an empty cell in the grid. The following keyword arguments may be used:</dd></dl><table style="text-align: left; margin-left: 80px;" border="0" cellpadding="4" cellspacing="0"><tbody><tr><td style="font-family: monospace;" align="left" valign="top">row_spacing</td><td style="vertical-align: top; white-space: nowrap; text-align: left;">Vertical space to leave between rows.</td></tr><tr><td style="vertical-align: top; text-align: left; font-family: monospace;">column_spacing</td><td style="vertical-align: top; white-space: nowrap; text-align: left;">Horizontal space to leave between columns.</td></tr><tr><td style="white-space: nowrap;"><span style="font-family: monospace;">padding = (0, 0)</span></td><td>Space to leave horizontally and vertically around all the items.</td></tr><tr><td style="vertical-align: top; text-align: left; font-family: monospace;">align = 'c'</td><td style="vertical-align: top; text-align: left; width: 100%;">Alignment of items within cells. A string made up of the letters <span style="font-family: monospace;">'l'</span>, <span style="font-family: monospace;">'r'</span>, <span style="font-family: monospace;">'t'</span>, <span style="font-family: monospace;">'b'</span> and <span style="font-family: monospace;">'c'</span> for left, right, top, bottom and centre.</td></tr><tr><td style="vertical-align: top; text-align: left; font-family: monospace;">equalize = ''</td><td style="vertical-align: top; text-align: left; width: 100%;">Specifies whether to make the size of all items equal in the horizontal and/or vertical direction. One of <span style="font-family: monospace;">'w'</span>, <span style="font-family: monospace;">'h'</span> or <span style="font-family: monospace;">'wh'</span>.</td></tr><tr><td style="white-space: nowrap; vertical-align: top;"><span style="font-family: monospace;">expand_row = None</span></td><td>Index
of a row whose items should change height when the container is
resized. Items in rows above are anchored to the top of the container,
and those in rows below are anchored to the bottom.</td></tr><tr><td style="white-space: nowrap; vertical-align: top;"><span style="font-family: monospace;">expand_column = None</span></td><td>Index
of a column whose items should change width whent the container is
resized. Items in columns to the left are anchored to the left of the
container, and those in columns to the right are anchored to the right.</td></tr></tbody></table><br>---</body></html>

View File

@ -0,0 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>GridView class</title></head><body><h1>class <tt>GridView(<a href="ScrollableView.html">ScrollableView</a>)</tt></h1>A
GridView is a user-defined view structured as a grid of equal-sized
cells. Abstract methods are provided for drawing the contents of a cell
and detecting mouse clicks in a cell based on their row and column
numbers.<br><br><i>Note: Don't confuse this with the <a href="Grid.html">Grid</a> class, which is a container for laying out other components in a grid.</i><br><br>The extent of a GridView is managed through the <tt>num_rows</tt>, <tt>num_columns</tt> and <tt>cell_size</tt> properties. The <tt>extent</tt> property inherited from ScrollableView should not be changed directly.<br><h2>Constructor</h2><blockquote><dl><dt><tt>GridView(num_rows, num_columns, cell_size)</tt></dt><dd>Creates a grid view whose extent initially covers the specified number of rows and columns.<br></dd></dl></blockquote><h2>Properties</h2><blockquote><dl><dt><tt>num_rows</tt></dt><dd>Number of rows in the view's extent.<br><br></dd><dt><tt>num_columns</tt></dt><dd>Number of columns in the view's extent.<br><br></dd><dt><tt>cell_size</tt></dt><dd>The size of each cell. A tuple (width, height).<br><br></dd><dt><tt>backcolor</tt></dt><dd><a href="Color.html">Color</a> with which to fill the background of a cell before calling <tt>draw_cell()</tt>, or <tt>None</tt> for no automatic background fill.<br></dd></dl></blockquote><h2>Abstract Methods</h2><blockquote><dl><dt><tt>draw_cell(</tt><i>canvas</i><tt>,</tt><i> row_number</i><tt>,</tt><i> column_number</i><tt>,</tt><i> cell_rect</i><tt>)</tt></dt><dd>Should draw the specified cell inside the given rectangle.<br><br></dd><dt><tt>click_cell(</tt><i>row_number</i><tt>,</tt> <i>column_number</i><tt>,</tt> <i>event</i><tt>)</tt></dt><dd>Called when a mouse_down event occurs in a cell.</dd></dl></blockquote><h2>Methods</h2><blockquote><dl><dt><tt>cell_rect(</tt><i>row_number</i><tt>,</tt> <i>column_number</i><tt>)</tt></dt><dd>Returns the rectangle corresponding to the cell at the given row and column numbers.<br><br></dd><dt><tt>cell_containing_point(</tt><i>point</i><tt>)</tt></dt><dd>Returns a tuple (<i>row_number, column_number</i>) indicating the cell in which the given point lies.<br></dd></dl></blockquote></body></html>

View File

@ -0,0 +1,26 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>PyGUI - Image</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></head>
<body>
<h1>class <tt>Image<tt>(<a href="ImageBase.html">ImageBase</a>)</tt></tt></h1>
The Image class represents an RGB image that can be loaded from a file
and drawn on a <a href="Canvas.html">Canvas</a>.<br>
<br>
On platforms which support it, an Image can have an alpha channel and will
be rendered with transparency.<br>
<h2>Constructors</h2>
<blockquote> <dl>
<dt><tt>Image(file</tt> <tt>=</tt> <i>filename</i><tt>)</tt></dt>
<dd>Creates an Image from the contents of the given file. The set of
supported file formats is platform-dependent.</dd>
<dd><i>Note:</i> The <span style="font-style: italic;">file </span>parameter must be specified using a
keyword argument.</dd>
</dl>
</blockquote>---<br>
<br>
<br>
</body></html>

View File

@ -0,0 +1,22 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - ImageBase class</title></head><body>
<h1>class <span style="font-family: monospace;">ImageBase</span></h1>
ImageBase is an abstract base class for 2D images that can be drawn on a Canvas.<br>
<h2>Properties</h2>
<blockquote> <dl><dt><tt>width</tt></dt><dd><i>Read only.</i> The width of the image in pixels.</dd></dl>
<dl><dt><tt>height</tt></dt><dd><i>Read only.</i> The height of the image in pixels.</dd></dl>
<dl><dt><tt>size</tt></dt><dd><i>Read only.</i> The size of the image in pixels.</dd></dl>
<dl><dt><tt>bounds</tt></dt><dd><i>Read only.</i> The bounding rectangle of the image. The
top left corner will always be (0, 0).</dd></dl>
</blockquote>
<h2>Methods</h2>
<blockquote> <dl><dt><tt>draw(canvas,</tt> <tt>src_rect,</tt> <tt>dst_rect)</tt></dt><dd>Draws the part of the image specified by <span style="font-style: italic;">src_rect</span> in the
area of the given <a href="Canvas.html">Canvas</a> specified by <span style="font-style: italic;">dst_rect.</span> If <span style="font-style: italic;">src_rect</span>
and <span style="font-style: italic;">dst_rect</span> are different sizes, the image is scaled to fit.</dd></dl>
</blockquote>
<br>
</body></html>

View File

@ -0,0 +1 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title>PyGUI - class Label</title> <meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"> </head> <body> <h1>class <tt>Label(Control)</tt></h1> <p>A&nbsp;Label is a control which displays a piece of static text.</p> <h2>Properties</h2> <dl> <dl> <dt><tt>text</tt></dt> <dd>The string to display.</dd> </dl> </dl> <dl> <dl> <dt><br> </dt> </dl> </dl> <br> </body> </html>

129
PyGUI-2.5.3/Doc/Menu.html Normal file
View File

@ -0,0 +1,129 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - class Menu</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>class <tt>Menu</tt></h1>
<p>From the point of view of the PyGUI API, a Menu is a collection of commands
that the user can invoke. The manner in which these commands are made available
to the user is platform-dependent, but typically a Menu instance will correspond
to a pull-down menu in a menu bar.<br>
</p>
<p>At any given moment, two sets of menus are available to the user, a set
of <i>application-wide</i> menus determined by the <tt>menus</tt> attribute
of the application object, and a set of <i>window-specific</i> menus determined
by the <tt>menus</tt> attribute of the currently active window.</p>
<p>A menu consists of a sequence of <i>menu</i> <i>items</i>, each of which
has the following characteristics:</p>
<ul>
<li>A <i>label</i></li>
<li>An optional <i>keyboard equivalent</i></li>
<li>An optional <i>check mark</i></li>
<li>An <i>enabled/disabled status</i><br>
</li>
<li>An internal<i> command name</i> for binding the menu item to an
action</li>
</ul>
<p>A menu item can stand alone, or it can be part of an <i>indexed group</i> of items which share the same command name and are distinguished by an integer
index. Examples of uses for indexed groups include a list of window titles
in a "Windows" menu, or a list of font names in a "Font" menu.<br>
</p>
<p>A menu can also contain separators for dividing items into visual groupings.<br>
</p>
<p>The label, keyboard equivalent and command name of a stand-alone menu item
are established when the menu is created and cannot be changed thereafter,
other than by discarding the whole Menu instance and creating a new one.
In contrast, the enabled/disabled status and check mark of each item, and
the contents of indexed groups, is established dynamically during the <i>setup
phase</i> of menu command processing. See <a href="menu_setup.html">Menu
Setup</a> for more information.<br>
</p>
<p>When a menu item is invoked by the user, its associated command name is
sent as a message up the message handling path starting from the current
target (see <a href="event_handling.html">Event Handling</a>). If the item
is part of an indexed group, its index is passed as a parameter of the message.<br>
</p>
<h2>Properties</h2>
<blockquote> <dl>
<dt><tt>title</tt></dt>
<dd><i>Read-only.</i> Title of the menu, to appear in the menu bar.</dd>
</dl>
</blockquote>
<h2>Constructor</h2>
<dl>
<dl>
<dt><tt>Menu(title,</tt> <i>item_spec</i><span style="font-style: italic;">s</span><tt>)</tt></dt>
<dd>Creates a Menu with the given title and the specified items. The <span style="font-style: italic;">item_specs</span> is a&nbsp; sequence of item specifications, each of which is one of the following:</dd>
<dd><br>
</dd>
<dd> <ul>
<li>A MenuItem instance<br>
</li><li>The string <tt>'-'</tt> (hyphen) representing a separator.</li>
<li>A tuple <tt>(</tt><i>item_descriptor</i><tt>,</tt> <i>command_name</i><tt>)</tt> representing a stand-alone menu item.</li>
<li>A tuple <tt>([</tt><i>item_descriptor</i><tt>,</tt> ...<tt>],</tt> <i>command_name</i><tt>)</tt> representing an indexed group of
menu items.<br>
</li>
</ul>
</dd>
<dd><br>
An <i>item descriptor</i> is a string specifying the item's label, optionally
ending with '<tt>/</tt>' (a slash) followed by a <i>keyboard equivalent</i>.
The keyboard equivalent consists of a <i>basic command character</i>, optionally
preceded by one or more characters representing additional <i>modifiers </i>beyond
the platform's standard menu-command modifier key.&nbsp;</dd>
<dd><br>
</dd>
<dd>The basic command character should be either an uppercase letter,
a digit, or one of the following characters: <tt>`-=[]\;',./</tt></dd>
<dd><br>
</dd>
<dd>An additional modifier character is one of the following:</dd>
<dd><br>
</dd>
<dd> <ul>
<li><tt>^</tt> (caret), representing the shift key.</li>
<li><tt>@</tt> (at-sign), representing a platform-dependent modifier
key. On the Macintosh it is the Option key; its meaning on other platforms
is yet to be determined.</li>
</ul></dd>
</dl><dt><br>
</dt>
</dl>
<h2>Properties</h2>
<div style="margin-left: 40px;">
<dl>
<dt style="font-family: monospace;">special</dt>
<dd>If true, then this is a menu that, by platform conventions,
should appear after other (non-special) menus in the menu bar. You
should probably not change this property yourself; it is used by the
framework code to achieve proper ordering of the standard menus.<br>
</dd>
</dl>
</div>
<h2>Methods</h2>
<div style="margin-left: 40px;">
<dl>
<dt><span style="font-family: monospace;">append(</span><span style="font-style: italic;">item</span><span style="font-family: monospace;">)</span></dt>
<dd>Adds an item to the end of the menu. The <span style="font-style: italic;">item</span> should be an item specification as described above.<br>
<br>
</dd>
<dt><span style="font-family: monospace;">extend(</span><span style="font-style: italic;">items</span><span style="font-family: monospace;">)</span></dt>
<dd>Adds items to the end of the menu. The <span style="font-style: italic;">items</span> should be a sequence of item specifications as described above.<br>
<br>
</dd>
<dt><span style="font-family: monospace;">item_with_command(</span><span style="font-style: italic;">command_name</span><span style="font-family: monospace;">)</span></dt>
<dd>Returns the MenuItem having the given command name, or None if there is no such item.</dd>
</dl>
</div>
---<br>
<br>
<br>
<dl>
<dt><br>
</dt>
</dl>
</body></html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - MenuItem class</title></head><body>
<h1>class <span style="font-family: monospace;">MenuItem</span></h1>
A MenuItem represents a menu item or item group.<br>
<br>
This class is not very useful yet. You can't construct MenuItems directly; the only way to obtain one is from an existing <a href="Menu.html">Menu</a> or <a href="MenuList.html">MenuList</a> using the <span style="font-family: monospace;">item_with_command</span> method, and you currently can't change any of its properties. Facilities for doing these things are planned.<br>
<br>
<br>
</body></html>

View File

@ -0,0 +1,39 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - MenuList class</title></head>
<body>
<h1>class <span style="font-family: monospace;">MenuList(list)</span></h1>
A MenuList is a specialised list subclass for holding Menu instances, for use as the <span style="font-family: monospace;">menus</span>
property of an Application or Window. It provides ways of finding menus
and menu items by command name, which allows you to modify the standard
menus without making platform-specific assumptions about their layout.<br>
<h2>Methods</h2>
<div style="margin-left: 40px;">
<dl>
<dt>
<span style="font-family: monospace;">menu_with_command(</span><span style="font-style: italic;">command_name</span><span style="font-family: monospace;">)</span>
</dt>
<dd>Returns the <a href="Menu.html">Menu</a> containing the item with the specified command name, or None if there is no such menu.<br>
<br>
</dd>
<dt><span style="font-family: monospace;">item_with_command(</span><span style="font-style: italic;">command_name</span><span style="font-family: monospace;">)</span></dt>
<dd>Returns the <a href="MenuItem.html">MenuItem</a> having the specified command name, or None if there is no such item.</dd>
</dl>
<dl>
</dl>
</div>
---<br>
<br>
</body></html>

View File

@ -0,0 +1,54 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - class MessageHandler</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]">
</head>
<body>
<!-- Changed by: Greg Ewing, 9-Dec-1997 -->
<h1>class <tt>MessageHandler </tt></h1>
<p>MessageHandler is an abstract base class for objects which
participate in the message delivery hierarchy. The message delivery
mechanism is used to handle events such as keystrokes and menu commands
which are not directed at a particular point on the screen. See <a href="event_handling.html">Event Handling</a> for more
information.</p>
<h2>Methods</h2>
<dl style="margin-left: 40px;">
<dt><tt>handle(msg_name, ...)</tt></dt>
<dd>If there is a method with the same name as the message,
calls it
with the message arguments. Otherwise, passes the message to the next
handler.<br><br></dd><dt style="font-family: monospace;">handle_here(msg_name, ...)</dt><dd>If there is a method with the same name as the message,
calls it
with the message arguments. Otherwise, does nothing.<br><br></dd><dt style="font-family: monospace;">handle_event(event)</dt><dd>Equivalent to <span style="font-family: monospace;">handle(event.kind, event)</span>.<br><br></dd><dt style="font-family: monospace;">handle_event_here(event)</dt><dd>Equivalent to <span style="font-family: monospace;">handle_here(event.kind, event)</span>.<br><br></dd><dt style="font-family: monospace;">pass_to_next_handler(msg_name, ...)</dt><dd>Calls the <span style="font-family: monospace;">handle()</span> method of the next message handler, if any.<br><br></dd><dt style="font-family: monospace;">pass_event_to_next_handler(event)</dt><dd>Equivalent to <span style="font-family: monospace;">pass_to_next_handler(event.kind, event)</span>.<br></dd>
<dt><tt>next_handler()</tt></dt>
<dd>Returns the object, if any, to which messages not handled
by this object should be passed up.</dd>
</dl>
<h2>Abstract Methods</h2>
<blockquote>
<dl>
<dt><tt>key_down(</tt><i>event</i><tt>)<br>
</tt></dt>
<dt><tt>key_up(</tt><i>event</i><tt>)</tt></dt>
<dd>These methods are called in response to keyboard events.
The default implementations pass the event to the next handler.<br><br>
</dd>
<dt><tt>setup_menus(menu_state)</tt></dt>
<dd>During the menu setup phase of menu command processing,
this method
is called for all handlers along the message path in reverse order,
i.e.
from the Application down to the current target. MessageHandlers should
use
this method to enable and otherwise configure any menu items that they
respond
to and which are currently valid.&nbsp;See <a href="menu_setup.html">Menu Setup</a> for more
information.</dd>
</dl>
<dl>
</dl>
</blockquote>
<br>
<br>
</body></html>

View File

@ -0,0 +1,40 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>PyGUI - ModalDialog class</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></head>
<body>
<h1>class <tt>ModalDialog(Dialog)</tt></h1>
The ModalDialog class is a subclass of <a href="Dialog.html">Dialog</a>
designed for modal dialogs. It has a default style of <tt>'modal_dialog'</tt>
and provides facilities for presenting the dialog modally.<br>
<br>
While a ModalDialog is active, interaction with other parts of the application
is prevented. Other windows cannot be activated, application-wide menu commands
other than those used by the dialog itself are not enabled, and unhandled
events and messages are not forwarded to the application.<br>
<h2>Constructor</h2>
<blockquote> <dl>
<dt><tt>ModalDialog(style</tt> <tt>=</tt> <tt>'modal_dialog',</tt></dt>
<dt><tt>&nbsp; &nbsp; </tt><tt>closable</tt> <tt>=</tt> <tt>False,</tt> <tt>resizable</tt> <tt>=</tt> <tt>False,</tt> <tt>zoomable</tt> = <tt>False</tt><tt>,</tt></dt>
<dt><tt>&nbsp; &nbsp; movable</tt> <tt>=</tt> <i>default</i><tt>,</tt> <tt>hidable</tt> =&nbsp;<i>default</i><tt>)</tt></dt>
<dd><br>Constructs a ModalDialog with the specified options. The default values
for the <tt>movable</tt> and <tt>hidable</tt> options are platform-dependent.</dd>
</dl>
</blockquote>
<h2>Methods</h2>
<blockquote> <dl>
<dt><tt>present()</tt></dt>
<dd>Present the dialog modally. The dialog is shown and a nested event
loop is entered which prevents interaction with any other part of the application.
This method retains control until the dialog's <tt>dismiss()</tt> method is
called. The dialog is then hidden and the <span style="font-family: monospace;">present()</span> method returns with the value passed to <tt>dismiss()</tt>.<br>
</dd>
</dl>
</blockquote>
<blockquote> <dl>
<dt><tt>dismiss(result</tt> <tt>=</tt> <tt>0)</tt></dt>
<dd>Hides the dialog and, if the dialog is being presented modally, causes the <tt>present()</tt> method to return with the given result as its return value.<br><br></dd><dt style="font-family: monospace;">ok()</dt><dd>Dismisses the dialog with the value <span style="font-family: monospace;">True</span>. By default, this method is called in response to pressing a <a href="Button.html#DefaultButton">DefaultButton</a> or&nbsp;a Return/Enter key event.<br><br></dd><dt style="font-family: monospace;">cancel()</dt><dd>Dismisses the dialog with the value <span style="font-family: monospace;">False</span>. By default, this method is called in response to pressing a&nbsp;<a href="Button.html#CancelButton">CancelButton</a> or&nbsp;an Escape key event.</dd>
</dl>
</blockquote>
---
</body></html>

View File

@ -0,0 +1,64 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title>Model class</title><meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>class <tt>Model(Properties)</tt></h1>
<p>A&nbsp;Model represents an application data structure which can have observers.
The observers are typically subclasses of <a href="View.html">View</a>, but need not be. Class Model
provides mechanisms for attaching and removing observers, and for notifying
observers when the Model changes.</p><p>A Model can have another Model or <a href="Document.html">Document</a> as a parent. When you call the <span style="font-family: monospace;">changed()</span>
method of a Model, the call is propagated to its parent, if any. If the
Model is ultimately contained in a Document, that Document will then be
marked as needing to be saved.</p><h3>Pickling behaviour</h3>Models
are designed to be pickled as a convenient way of saving and restoring
the state of a Document. There are two ways in which class Model
provides special support for pickling.<br><ul><li>The link
between a Model and its observers is maintained outside the Model
object, so that the observers will not be pickled along with the Model.<br></li><li><a name="pickling_parent"></a>There
is a mechanism to prevent the parent object of a Model from being
pickled when it would not be appropriate to do so. By default, this
mechanism is used to prevent a Document reached via the parent
attribute of a Model from being pickled. This is important, because
normally you only want to save the contents of a Document, not the
Document object itself. Furthermore, the Document contains references
to the Application and all of the Windows attached to it, so pickling
the Document would result in attempting to pickle almost the entire
state of the application.<br><br>The mechanism involves looking for an attribute called <span style="font-family: monospace; font-weight: bold;">pickle_as_parent_model</span> on the object referenced by the model's <a href="#parent"><span style="font-family: monospace;">parent</span></a> attribute. If that attribute exists and has a <span style="font-style: italic;">false</span> value, then the <span style="font-family: monospace;">parent</span> attribute is omitted from the pickled state of the Model. Class Document has a <span style="font-family: monospace;">pickle_as_parent_model</span> attribute that defaults to False (and you should not change it).<br><br>A
consequence is that the parent link from a Model to a containing
Document is not automatically restored. You will need to set it
yourself after unpickling in the Document's <span style="font-family: monospace;">read_contents()</span> method.</li></ul><h2>Constructor</h2><dl style="margin-left: 40px;"><dt style="font-family: monospace;">Model(parent = None)</dt><dd>Creates a Model with the specified parent.</dd></dl><h2>Properties</h2>
<blockquote> <dl>
<dt><tt>views</tt></dt>
<dd>List of objects which are observing this Model. <i>Do not modify this
list directly;</i> use the <tt>add_view</tt> and <tt>remove_view</tt> methods
to add and remove observers.</dd>
</dl>
</blockquote>
<h2>Attributes</h2><dl style="margin-left: 40px;"><dt style="font-family: monospace;"><a name="parent"></a>parent</dt><dd>Containing Model or Document, if any.</dd></dl><h2>Methods</h2>
<blockquote> <dl>
<dt><tt>add_view(view)</tt></dt>
<dd>Adds the given object as an observer of this Model. If the object
defines an <tt>add_model</tt> method, it is called with this Model as argument.</dd>
</dl>
<dl>
<dt><tt>remove_view(view)</tt></dt>
<dd>Removes the given object as an observer of this Model. If the object
defines a <tt>remove_model</tt> method, it is called with this Model as argument.</dd>
</dl>
<dl>
<dt><tt>notify_views(message = 'model_changed', ...)</tt></dt>
<dd>Calls a method of each observer with the same name as the message,
passing it any additional arguments.<br><br></dd><dt style="font-family: monospace;">changed()</dt><dd>If the Model is contained in a Document, mark the Document as needing to be saved.</dd>
</dl>
</blockquote>
<h2>Pickle protocol</h2><dl style="margin-left: 40px;"><dt style="font-family: monospace;">__getstate__()<br>__setstate__(state)</dt><dd>These methods implement the <a href="#pickling_parent">special treatment of the parent attribute</a> when pickling. The <span style="font-family: monospace;">__getstate__</span> method returns a possibly-modified version of the Model's <span style="font-family: monospace;">__dict__</span>, and the <span style="font-family: monospace;">__setstate__</span> method restores it. If you implement your own custom pickling behaviour, you should build on these methods.</dd></dl><h2>Destructor</h2>
<blockquote> <dl>
<dt><tt>destroy</tt></dt>
<dd>Dissociates the Model from any attached observers, and calls the
<tt>model_destroyed</tt> method of each observer which defines it.</dd>
</dl>
</blockquote>
<br>
<br>
</body></html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>Numerical module</title></head><body><h1>module Numerical</h1>The Numerical module provides some facilities for interfacing with <a href="http://numpy.scipy.org/">NumPy</a>.<br><h2>Functions</h2><dl><dt style="font-family: monospace;">image_from_ndarray(array, format, size = None)</dt><dd>Creates an <a href="Image.html">Image</a> from a NumPy array of type <span style="font-family: monospace;">uint8</span>. The <span style="font-family: monospace;">format</span> may be <span style="font-family: monospace;">'RGB'</span> or <span style="font-family: monospace;">'RGBA'</span>. If a <span style="font-family: monospace;">size</span> is specified, it should be a tuple (<span style="font-style: italic;">width</span>, <span style="font-style: italic;">height</span>),
and the array will be implicitly reshaped to match the specified size
and format. Otherwise the array must have 3 dimensions, the size is
inferred from the first two dimensions of the array, and the third
dimension must match the number of bytes required by the format.<br><br>If
possible, the returned Image will share data with the original array,
but this is not guaranteed. The effect of modifying the array after
creating the image is undefined.</dd></dl>---</body></html>

5
PyGUI-2.5.3/Doc/PIL.html Normal file
View File

@ -0,0 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PIL module</title></head>
<body><h1>module <span style="font-family: monospace;">PIL</span></h1>The PIL module provides some facilities for interfacing with the <a href="http://www.pythonware.com/products/pil/">Python Imaging Library</a>.<br><h2>Functions</h2><dl><dt style="font-family: monospace;">image_from_pil_image(pil_image)</dt><dd>Creates an <a href="Image.html">Image</a> from a PIL image object.<br><br></dd><dd><span style="font-weight: bold;">Supported PIL image modes</span><br><br>Modes "RGB" and "RGBA" are
supported on all platforms.</dd><dd>Mode "P" (indexed) is not supported on any
platform.</dd><dd>Other modes may or may not be supported.</dd><dt></dt></dl></body></html>

View File

@ -0,0 +1,29 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PageSetup class</title></head>
<body><h1>class <span style="font-family: monospace;">Printing.PageSetup</span></h1>An instance of the PageSetup class is used to hold the information specified by the <span style="font-style: italic;">Page Setup</span> command, such as margins, paper size and orientation.<br><br>The
Application object maintains a default PageSetup instance in its
page_setup property, and provides a default implementation of the Page
Setup command which edits it. When a view prints itself in response to
the <span style="font-style: italic;">Print</span> command, if it can't obtain a PageSetup object from its associated model, it uses the one from the Application.<br><br>There
is no provision for saving the Application's PageSetup object; its
settings are retained only as long as the application runs. If you want
page setup information saved with your document, you should attach a
PageSetup object of your own to it and save it along with your
document's data (see below).<br><br>You can explicitly invoke a Page Setup dialog for a specific PageSetup object using the <a href="#present_page_setup_dialog"><span style="font-family: monospace;">present_page_setup_dialog()</span></a> function.<h3>Saving page setup information</h3>PageSetup
objects are pickleable, to facilitate saving and restoring them. This
method is recommended, rather than saving its properties individually,
because pickled PageSetup objects retain platform-dependent information
that may not be exposed through the generic&nbsp;properties. If you
pickle a PageSetup object and later restore it on the same platform,
all of the platform-specific information will be preserved.<br><br>The
generic&nbsp;properties are also saved in a platform-independent way,
so that if you unpickle it on a different platform, the most important
attributes ought to come across as best they can.<br><br>There are also <span style="font-family: monospace;">from_string()</span> and <span style="font-family: monospace;">to_string()</span>
methods which take and return a pickled representation as a string. You
may find these more convenient if you are using a non-pickle-based file
format.<br><h2>Constructor</h2><dl style="margin-left: 40px;"><dt style="font-family: monospace;">PageSetup()</dt><dd>Creates a PageSetup object with default settings.</dd></dl><h2>Properties</h2><dl style="margin-left: 40px;"><dt style="font-family: monospace;">paper_name</dt><dd>A string describing the paper size, such as "A4" or "Letter".<br><br></dd><dt style="font-family: monospace;">paper_size</dt><dd>A tuple (width, height) giving the size of the paper in points.<br><br></dd><dt style="font-family: monospace;">orientation</dt><dd>One of <span style="font-family: monospace;">'portrait'</span> or <span style="font-family: monospace;">'landscape'</span>.<br><br></dd><dt style="font-family: monospace;">printer_name</dt><dd>The name of the printer for which the page setup has been created.<br><br></dd><dt style="font-family: monospace;">left_margin<br>top_margin<br>right_margin<br>bottom_margin</dt><dd>Distances from the edge of the paper to the printed area.<br><br></dd><dt style="font-family: monospace;">margins</dt><dd>A tuple containing the four margin values.<br></dd><dt style="font-family: monospace;">page_width<br>page_height<br>page_size</dt><dd>The size of the printed area. &nbsp;This is equal to the paper size minus the margins.<br></dd><dt style="font-family: monospace;">page_rect</dt><dd>A
rectangle representing the printed area. The origin of the coordinate system is at the
top left corner of the page.</dd></dl><h2>Class Methods</h2><dl style="margin-left: 40px;"><dt><span style="font-family: monospace;">from_string(</span><span style="font-style: italic;">string</span><span style="font-family: monospace;">)</span></dt><dd>Creates a PageSetup object from a string returned by the <span style="font-family: monospace;">to_string()</span> method.</dd></dl><h2>Methods</h2><dl style="margin-left: 40px;"><dt style="font-family: monospace;">to_string()</dt><dd>Returns a string-encoded representation suitable for passing to <span style="font-family: monospace;">from_string()</span>.</dd></dl><h2>Related Functions</h2><dl><dt style="font-family: monospace;"><a name="present_page_setup_dialog"></a>Printing.present_page_setup_dialog(page_setup)</dt><dd>Presents a <span style="font-style: italic;">Page Setup</span>
dialog box for the specifed PageSetup object and allows the user to
edit it. If the user accepts the changes, true is returned. Otherwise,
the PageSetup object is unaltered and false is returned.</dd></dl>---</body></html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PaletteView class</title></head><body><h1>class <tt>PaletteView(<a href="GridView.html">GridView</a>)</tt></h1>A
PaletteView is a specialised subclass of GridView designed for
implementing tool palettes and other such components. Instead of row
and column numbers, the cells in a PaletteView are identified by a
single integer index, called an <i>item number,</i> with items being numbered from left to right, top to bottom.<br><br>The PaletteView also has a notion of one or more items being <i>selected</i>, and provides support for highlighting selected items in a variety of ways.<br><br>PaletteView inherits from <a href="ScrollableView.html">ScrollableView</a> and can therefore be made scrollable if needed, although it does not show any scroll bars by default.<br><br>The extent of a PaletteView is managed through the <tt>num_items</tt>, <tt>items_per_row</tt> and <tt>cell_size</tt> properties. The <tt>num_rows</tt> and <tt>num_columns</tt> properties inherited from GridView, and the <tt>extent</tt> property inherited from ScrollableView, should not be changed directly.<br><h2>Constructor</h2><blockquote><dl><dt><tt>PaletteView(</tt><i>num_items</i><tt>,</tt> <i>items_per_row</i><tt>, </tt><i>cell_size</i><tt>)</tt></dt><dd>Creates a palette view with the specified initial property values.</dd></dl></blockquote><h2>Properties</h2><blockquote><dl><dt><tt>num_items</tt></dt><dd>Total number of items in the palette. The items will be laid out with <tt>items_per_row</tt> items in each row, using as many rows as necessary. If <tt>num_items</tt> is not an even multiple of<tt> items_per_row</tt>, some cells in the last row will be left empty.<br><br></dd><dt><tt>items_per_row</tt></dt><dd>The number of items in each row of the palette's extent.<br><br></dd><dt><tt>highlight_style</tt></dt><dd>The style in which to highlight selected items. Possible values are:<br><br><ul><li><tt>'fill'</tt> - the cell is filled with the highlight_color before calling draw_item().<br></li><li><tt>'frame'</tt> - a rectangle is drawn around the cell as specified by highlight_color and highlight_thickness before calling draw_item().<br></li><li><tt>''</tt> or <tt>None</tt> - no automatic highlighting is performed.</li></ul><br></dd><dt><tt>highlight_color</tt></dt><dd><a href="Color.html">Color</a> to use for highlighting of selected items.<br><br></dd><dt><tt>highlight_thickness</tt></dt><dd>When using the <tt>'frame'</tt> highlight style, the pen width to use for drawing the highlight rectangle.<br></dd></dl></blockquote><h2>Abstract Methods</h2><blockquote><dl><dt><tt>draw_item(</tt><i>canvas</i><tt>,</tt> <i>item_number</i><tt>,</tt> <i>item_rect</i><tt>)</tt></dt><dd>Should draw the specified item in the given rectangle. Any automatic highlighting specified by the <tt>highlight_style</tt> property has already been applied.<br><br></dd><dt><tt>click_item(</tt><i>item_number</i><tt>,</tt><i> event</i><tt>)</tt></dt><dd>Called when a mouse_down event occurs in an item.<br><br></dd><dt><tt>item_is_selected(</tt><i>item_number</i><tt>)</tt></dt><dd>Should return true if the indicated item is to be regarded as selected.<br><br></dd><dt><tt>draw_item_and_highlight(</tt><i>canvas</i><tt>,</tt> <i>item_number</i><tt>,</tt> <i>item_rec</i>t<tt>, </tt><i>highlight</i><tt>)</tt></dt><dd>This method can optionally be overridden instead of <tt>draw_item()</tt>
to gain more control over how items are highlighted. Your
implementation should draw the specified item, and apply highlighting
if highlight is true.&nbsp;If you override this method, <tt>draw_item()</tt> is not called and no automatic highlighting is performed.</dd></dl></blockquote><h2>Methods</h2><blockquote><dl><dt><tt>item_rect(</tt><i>item_number</i><tt>)</tt></dt><dd>Returns the rectangle corresponding to the given item number. If the item number is out of bounds (less than 0 or greater than <tt>num_items</tt> - 1), returns <tt>None</tt>.<br><br></dd><dt><tt>item_no_of_cell(</tt><i>row_number</i><tt>,</tt> <i>column_number</i><tt>)</tt></dt><dd>Returns the item number corresponding to the specified cell, or <tt>None</tt> if the cell does not correspond to a valid item.<br><br></dd><dt><tt>cell_of_item_no(</tt><i>item_number</i><tt>)</tt></dt><dd>Returns the row and column numbers of the cell corresponding to the given item number. If the item number is out of bounds (less than 0 or greater than <tt>num_items</tt> - 1), returns <tt>None</tt>.</dd></dl></blockquote></body></html>

View File

@ -0,0 +1,24 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>PyGUI - Class Pixmap</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></head>
<body>
<h1>class <tt>Pixmap(<a href="ImageBase.html">ImageBase</a>)</tt></h1>
A Pixmap is an offscreen area that can be used both as a destination for
drawing and a source of image data for drawing in a View or another Pixmap.<br>
<h2>Constructor</h2>
<blockquote>
<dl>
<dt><tt>Pixmap(width</tt><tt>,</tt> <tt>height)</tt></dt>
<dd>Creates a new, empty Pixmap with the given width and height.</dd>
</dl>
</blockquote><h2>Methods</h2><blockquote><dl><dt><tt>with_canvas(proc)</tt></dt>
<dd>Calls the given procedure with a <a href="Canvas.html">Canvas</a>
suitable for drawing on this Pixmap. The canvas is valid only for the duration
of the call, and should not be retained beyond it.</dd>
</dl>
</blockquote>
---<br>
<br>
</body></html>

View File

@ -0,0 +1,21 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>Printable class</title></head>
<body><h1>class <span style="font-family: monospace;">Printing.Printable</span></h1><span style="font-family: monospace;">Printable</span> is an abstract base class for components that provide an implementation of the <span style="font-style: italic;">Print</span> command.<br><br>If
enabled for the instance concerned, components inheriting from this
class will automatically enable the Print command and will print
themselves in response to it.<br><br>Printing behaviour is controlled by the <span style="font-family: monospace;">printable</span>
property. Setting this property to false causes the Print command to be
ignored and passed on to the Document or Application. You may need to
do this if you want your document to be printed in a different way than
it appears on screen. See the Printing topic for more information.<br><br>Printable components in the PyGUI framework include <a href="View.html">View</a>, <a href="ScrollableView.html">ScrollableView</a> and <a href="TextEditor.html">TextEditor</a>.<br><br>Note:<span style="font-style: italic;">
The Printable class is designed for internal use by the PyGUI framework
only; you should not inherit directly from it yourself. To implement a
printable view, base it on one of the concrete component classes listed
above.</span><br><h2>Properties</h2><dl style="margin-left: 40px;"><dt style="font-family: monospace;">printable</dt><dd>If true, the <span style="font-style: italic;">Print</span> command is handled by this component, otherwise it is passed on to the next handler. Defaults to true.<br><br></dd><dt style="font-family: monospace;">page_setup</dt><dd><span style="font-style: italic;">Read only.</span> The <a href="PageSetup.html">PageSetup</a> instance to be used when printing this component. By default, a <span style="font-family: monospace;">page_setup</span> attribute is looked for on the associated <span style="font-family: monospace;">model</span>, if any. If there is no model, or it does not have a <span style="font-family: monospace;">page_setup</span> attribute,
or its value is None, the application's default PageSetup instance is
used. You can customise this behaviour by overriding the <span style="font-family: monospace;">get_page_setup()</span> method.<br><br></dd><dt style="font-family: monospace;">print_title</dt><dd><span style="font-style: italic;">Read only.</span>
Title to use for print jobs. The usage of this property is
platform-dependent. Defaults to the title of the containing Window. You
can customise it by overriding the <span style="font-family: monospace;">get_print_title()</span> method.</dd></dl><h2>Methods</h2><dl style="margin-left: 40px;"><dt style="font-family: monospace;">print_cmd()</dt><dd>Implements the standard <span style="font-style: italic;">Print</span> command by calling<span style="font-family: monospace;"> print_view()</span> with the value of the <span style="font-family: monospace;">page_setup</span> property.</dd></dl><dl style="margin-left: 40px;"><dt style="font-family: monospace;">print_view(page_setup, prompt = True)</dt><dd>Prints the contents of the component using the specified <a href="PageSetup.html">PageSetup</a> object. If <span style="font-style: italic;">prompt</span>
is true, a printing dialog is first displayed, otherwise the printing
operation is started immediately without user interaction.<br></dd></dl><h2>Abstract Methods</h2><dl style="margin-left: 40px;"><dt><span style="font-family: monospace;">get_page_setup()</span></dt><dd>Override this to customise the way the <a href="PageSetup.html">PageSetup</a> object is obtained when handling the <span style="font-style: italic;">Print</span> command.<br><br></dd><dt style="font-family: monospace;">get_print_title()</dt><dd>Determines the value of the <span style="font-family: monospace;">print_title</span> property.</dd></dl>---</body></html>

View File

@ -0,0 +1 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title>PyGUI - RadioButton</title> <meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"> </head> <body> <h1>class <tt>RadioButton(Control)</tt></h1> <p>A RadioButton is similar to a <a href="CheckBox.html">CheckBox</a>, except that RadioButtons are typically arranged in mutually-exclusive groups, so that only one member of a group is on<i> </i>at a time. The appearance of a RadioButton may differ from that of a CheckBox, depending on platform conventions.</p> <p>The <a href="RadioGroup.html">RadioGroup</a> class is used to coordinate the behaviour of a group of RadioButtons. Unlike CheckBoxes, RadioButtons do not have individual <i>on</i> or <i>action</i> properties; the function of these is performed by the RadioGroup to which the radio buttons belong.</p> <h2>Properties</h2> <blockquote> <dl> <dt><tt>title</tt></dt> <dd>Title string to display beside the radio button.</dd> </dl> <dl> <dt><tt>group</tt></dt> <dd>The <a href="RadioGroup.html">RadioGroup</a> instance to which this button belongs.</dd> </dl> <dl> <dt><tt>value</tt></dt> <dd>Value associated with this RadioButton. If attached to a <a href="RadioGroup.html">RadioGroup</a>, when the button is selected the value of the group will be set to this value.</dd> </dl> </blockquote> <p>---</p> <br> <br> </body> </html>

View File

@ -0,0 +1,62 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - class RadioGroup</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>class <tt>RadioGroup</tt></h1>
<p>A&nbsp;RadioGroup is used to coordinate the activity of a group of <a href="RadioButton.html">RadioButtons</a>. It ensures that only one of the
RadioButtons is on at a time, and provides a <tt>value</tt> property which
is equal to the <tt>value</tt> of the currently selected RadioButton. It
also provides an <tt>action</tt> property which is invoked when the user
changes the selection.<br>
</p>
<p>You can iterate over the RadioButtons contained in a RadioGroup, which means you can use a RadioGroup directly in the <a href="Container.html#place_row"><span style="font-family: monospace;">place_row</span></a> and <a style="font-family: monospace;" href="Container.html#place_column">place_column</a> methods of a container.<br>
</p>
<h2>Properties</h2>
<dl>
<dl>
<dt><tt>value</tt></dt>
<dd>The value of the currently selected RadioButton. Setting this property
updates the states of the&nbsp;RadioButtons accordingly.</dd>
</dl>
</dl>
<blockquote>
<dl>
<dt><tt>action</tt></dt>
<dd>Action to perform when the value changes as a result of the user
clicking on a radio button.</dd>
</dl>
</blockquote>
<h2>Constructor</h2>
<dl>
<dl>
<dt><tt>RadioGroup(items)</tt></dt>
<dd>Constructs a RadioGroup containing the given list of RadioButtons.</dd>
</dl>
</dl>
<h2>Methods</h2>
<dl>
<dl>
<dt><tt>add_item(</tt><i>item</i><tt>)<br>add_items([</tt><i>item, </i>...<span style="font-family: monospace;">])</span></dt>
<dd>Adds one or more RadioButtons to this group.</dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>remove_item(</tt><i>item</i><tt>)<br>remove_items([</tt><i>item, ...</i><span style="font-family: monospace;">])</span></dt>
<dd>Removes one or more RadioButtons from this group.</dd>
</dl>
</dl>
<h2>Operations</h2>
<dl style="margin-left: 40px;">
<dt><span style="font-family: monospace;">iter(</span><span style="font-style: italic;">group</span><span style="font-family: monospace;">)</span></dt>
<dd>Returns an iterator over the RadioButtons contained in the group.<br>
</dd>
</dl>
<p>---</p>
</body></html>

View File

@ -0,0 +1,70 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - Resources</title></head>
<body>
<h1>module <span style="font-family: monospace;">Resources</span></h1>
A <span style="font-style: italic;">resource</span> is a file
containing information used by the application that is bundled with the
application. PyGUI provides some functions for locating resources by
looking in certain standard places for them.<br>
<br>
A resource is specified by a <span style="font-style: italic;">resource name</span>. This is a relative pathname using '/' as a directory separator on all platforms. A resource specification may also include a <span style="font-style: italic;">type</span>, which is a filename suffix (excluding the dot) to be appended to the resource name.<br>
<br>
The standard locations searched for resources are as follows:<br>
<br>
<table style="text-align: left; width: 100%;" border="1" cellpadding="6" cellspacing="0">
<tbody>
<tr>
<th style="vertical-align: top;">Search Order<br>
</th>
<th style="vertical-align: top;">MacOSX applications created with Py2App<br>
</th>
<th style="vertical-align: top;">Other platforms<br>
</th>
</tr>
<tr>
<td style="vertical-align: top;">1. Application resources<br>
</td>
<td style="vertical-align: top;">The Resources directory in the application bundle.<br>
</td>
<td style="vertical-align: top;">A directory called <span style="font-family: monospace;">Resources</span> in the same directory as the application's main Python code file or its parent directory.<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">2. PyGUI standard resources<br>
</td>
<td colspan="2" style="vertical-align: top;">A platform-dependent location within the PyGUI installation.<br>
</td>
</tr>
</tbody>
</table>
<br>
<h2>Global Functions</h2>
<dl>
<dt><span style="font-family: monospace;">find_resource(</span><span style="font-style: italic;">name</span><span style="font-family: monospace;">,</span> <span style="font-style: italic;">type</span> <span style="font-family: monospace;">=</span> <span style="font-family: monospace;">None)</span></dt>
<dd>Searches for the named resource and returns the full pathname of the first matching file found on the search path. If <span style="font-style: italic;">type</span> is specified, it is appended to the name with a dot between, after removing any existing dot-suffix from the <span style="font-style: italic;">name</span>. The <span style="font-style: italic;">type</span> itself should not contain a dot. If no matching file is found,&nbsp; <span style="font-family: monospace;">ResourceNotFoundError</span> is raised.<br>
<br>
</dd>
<dt><span style="font-family: monospace;">lookup_resource(</span><span style="font-style: italic;">name</span><span style="font-family: monospace;">,</span> <span style="font-style: italic;">type</span> <span style="font-family: monospace;">=</span> <span style="font-family: monospace;">None)</span></dt>
<dd>Searches for a resource as per <span style="font-family: monospace;">find_resource</span>, but if the resource is not found, <span style="font-family: monospace;">None</span> is returned instead of raising an exception.<br><br></dd><dt style="font-family: monospace;">get_resource(loader, name, type = None, default = None, **kwds)</dt><dd>Finds a resource and loads it using the specified <span style="font-family: monospace;">loader</span> function. The loader is called as <span style="font-family: monospace;">loader<span style="font-style: italic;">(</span></span><span style="font-style: italic;">path</span><span style="font-family: monospace;">, **kwds)</span> where <span style="font-style: italic;">path</span>
is the full pathname of the resource. The loaded resource is cached,
and subsequent calls referencing the same resource will return the
cached value. If the resource is not found, the specified <span style="font-family: monospace;">default</span> is returned if any, otherwise <span style="font-family: monospace;">ResourceNotFoundError</span> is raised.</dd>
</dl>
<h2>Global Variables</h2>
<dl>
<dt style="font-family: monospace;">resource_path</dt><dd>A list of directory names to search for resources. This is
initialised on startup to include the standard locations for PyGUI
application resources. You can insert additional directories in this
list to customise the search path.</dd>
</dl>
<h2>Exceptions</h2>
<dl>
<dt style="font-family: monospace;">ResourceNotFoundError</dt>
<dd>Raised by <span style="font-family: monospace;">find_resource</span> when a resource cannot be found.<br>
</dd>
</dl>
---<br>
<br>
</body></html>

12
PyGUI-2.5.3/Doc/Row.html Normal file
View File

@ -0,0 +1,12 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>Row class</title></head>
<body><h1>class <span style="font-family: monospace;">Row(<a href="Frame.html">Frame</a>)</span></h1>A&nbsp;Row is a container that lays out a collection of components in a horizontal row.<br><br>The
initial size of the container is made just big enough to hold its
contents. The vertical alignment of items within the row may be
specified, and one item may optionally be designated to expand
horizontally when the container is resized. <br><br>In addition, the width and/or height of all items may optionally be equalized before they are laid out.<br><h2>Constructor</h2><dl style="margin-left: 40px;"><dt><span style="font-family: monospace;">Row(</span><span style="font-style: italic;">items</span>, <span style="font-style: italic;">keyword</span> <span style="font-family: monospace;">=</span> <span style="font-style: italic;">value</span><span style="font-family: monospace;">,</span> ...<span style="font-family: monospace;">)</span></dt><dd>Creates a Row containing the specified <span style="font-style: italic;">items</span>, which should be a sequence of Components. The following keyword arguments may be used:</dd></dl><table style="text-align: left; margin-left: 80px;" border="0" cellpadding="4" cellspacing="0"><tbody><tr><td style="vertical-align: top; text-align: left; font-family: monospace; white-space: nowrap;">spacing = 10</td><td align="left" valign="top">Horizontal space to leave between items.</td></tr><tr><td style="white-space: nowrap;"><span style="font-family: monospace;">padding = (0, 0)</span></td><td>Space to leave horizontally and vertically around all the items.</td></tr><tr><td style="vertical-align: top; text-align: left; font-family: monospace; white-space: nowrap;">align = 'c'</td><td align="left" valign="top">Specifies vertical alignment and anchoring of items. One of <span style="font-family: monospace;">'t'</span>, <span style="font-family: monospace;">'c'</span>, <span style="font-family: monospace;">'b'</span> or <span style="font-family: monospace;">'tb'</span> for top, centre, bottom or top-and-bottom.</td></tr><tr><td style="font-family: monospace;" align="left" valign="top">equalize = ''</td><td style="vertical-align: top; text-align: left; width: 100%;">Specifies whether to make the size of all items equal in the horizontal and/or vertical direction. One of <span style="font-family: monospace;">'w'</span>, <span style="font-family: monospace;">'h'</span> or <span style="font-family: monospace;">'wh'</span>.</td></tr><tr><td style="font-family: monospace;" align="left" valign="top">expand = None</td><td style="vertical-align: top; text-align: left; width: 100%;">Specifies
which item, if any, is to change size horizontally when the container
is resized. May be the item itself or an index into the item list.
Items to the left of this item will be anchored to the left of
the&nbsp;container, and items to the right will be anchored to the
right of the&nbsp;container.<br><br>If specified by an index, the item at that index may be <span style="font-family: monospace;">None</span> to leave an expanding space in the row.</td></tr></tbody></table><br>---</body></html>

View File

@ -0,0 +1,46 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>ScrollableView class</title></head>
<body>
<h1>class <span style="font-family: monospace;">ScrollableView(<a href="ViewBase.html">ViewBase</a>, <a href="Printable.html">Printable</a>)</span></h1>
A ScrollableView is a <a href="View.html">View</a> with support for scrolling.<br>
<h2>Properties</h2>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">scrolling</dt>
<dd>A string containing <span style="font-family: monospace;">'h'</span> to enable horizontal scrolling and <span style="font-family: monospace;">'v'</span> to enable vertical scrolling.<br>
<br>
</dd>
<dt style="font-family: monospace;">hscrolling</dt>
<dd>True if horizontal scrolling is enabled.<br>
<br>
</dd>
<dt style="font-family: monospace;">vscrolling</dt>
<dd>True if vertical scrolling is enabled.<br>
<br>
</dd>
<dt><tt>extent</tt></dt>
<dd>Tuple (<span style="font-style: italic;">width, height</span>) defining the size of the scrollable area.<br>
<br>
</dd>
<dt><tt>scroll_offset</tt></dt>
<dd>Tuple (<span style="font-style: italic;">dx, dy</span>) representing the difference in local coordinates between
the top left corner of the view's bounds and the top left corner of the
extent. Assigning to this property will cause the view to scroll. The value
is clamped to the allowable scrolling range, as determined by the current
bounds and extent.<br>
<br>
</dd>
<dt><tt>line_scroll_amount</tt></dt>
<dd>Tuple (<span style="font-style: italic;">dh, dv</span>) representing the size of a "line" in each direction
for scrolling purposes.<br><br></dd><dt><tt>background_color</tt></dt><dd><a href="Color.html"><tt>Color</tt></a> with which to fill any visible area of the view that lies outside the extent, or <tt>None</tt> to suppress automatic background drawing. When a background color is specified, the <tt>update_rect</tt> passed to the <tt>draw()</tt> method is clipped to exclude areas outside the extent.<br><br><i>Note:</i> On MacOSX, it is impossible to draw outside the view's extent even when the background color is set to None.</dd>
</dl>
<h2>Methods</h2>
<dl style="margin-left: 40px;">
<dt><tt>scroll_by(</tt><i>dx</i><tt>,</tt> <i>dy</i><tt>)</tt></dt><dd>Scrolls the view by the given horizontal and vertical amounts, within
the limits defined by the extent.</dd><dd><br>
</dd><dt><tt>scroll_line_left()</tt></dt><dt><tt>scroll_line_right()</tt></dt><dt><tt>scroll_line_up()</tt></dt><dt><tt>scroll_line_down()</tt></dt><dd>Scrolls the view by one line in the specified direction, as determined
by the <tt>line_scroll_amount</tt> property.</dd><dd><br>
</dd><dt><tt>scroll_page_left()</tt></dt><dt><tt>scroll_page_right()</tt></dt><dt><tt>scroll_page_up()</tt></dt><dt><tt>scroll_page_down()</tt></dt><dd>Scrolls the view by one page in the specified direction. The size
of a page is equal to the size of the viewed rectangle minus the <tt>line_scroll_amount</tt>.</dd>
</dl>
---<br>
</body></html>

View File

@ -0,0 +1,32 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - class GL.ShareGroup</title></head>
<body>
<h1>class <span style="font-family: monospace;">GL.ShareGroup</span></h1>
A ShareGroup represents a set of OpenGL contexts (<a href="GLView.html">GLViews</a> or <a href="GLPixmap.html">GLPixmaps</a>) that are sharing textures and display lists.<br>
<br>
To set up a group of shared OpenGL contexts, you first create a ShareGroup, then you pass it as the <span style="font-weight: bold;">share_group</span> parameter when constructing the GLViews and GLPixmaps that you want to be members of the group.<br>
<br>
You can iterate over the members of a ShareGroup, and you can use the
<span style="font-family: monospace;">in</span> operator to test whether a given GLView or GLPixmap is a member of
the group. However, you can't explicitly add or remove members. A
member can only be added by creating in the manner described above, and
it is automatically removed from the group when it is no longer
referenced elsewhere.<br>
<h2>Constructor</h2>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">ShareGroup()</dt>
<dd>Creates a new share group.</dd>
</dl>
<h2>Operations</h2>
<dl style="margin-left: 40px;">
<dt><span style="font-family: monospace;">iter(</span><span style="font-style: italic;">share_group</span><span style="font-family: monospace;">)</span></dt>
<dd>Returns an iterator over the members of the group (GLViews or GLPixmaps).<br>
<br>
</dd>
<dt><span style="font-style: italic;">obj</span> <span style="font-family: monospace;">in</span> <span style="font-style: italic;">share_group</span></dt>
<dd>Tests whether <span style="font-style: italic;">obj</span> is a member of the share group.</dd>
</dl>
--<br>
<br>
<br>
</body></html>

View File

@ -0,0 +1,52 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - class Slider</title></head><body>
<h1>class Slider(<a href="Control.html">Control</a>)</h1>
A Slider is a control that allows a user to select a value by dragging
a knob along a scale. The range of values may be either discrete or
continuous, and an action may be specified to be invoked whenever the
user changes the value.<br>
<h2>Constructor</h2>
<div style="margin-left: 40px;">
<dl>
<dt style="font-family: monospace;">Slider(orient)</dt>
<dd>Constructs a Slide with the specified orientation, 'h' for horizontal and 'v' for vertical.<br>
Note: On some platforms, the orientation of the slider is determined by
its relative width and height; on such platforms, the orient parameter
is ignored. For maximum portability, ensure that the dimensions of the
control and the orient parameter are in agreement with each other.</dd>
</dl>
</div>
<h2>Properties</h2>
<div style="margin-left: 40px;">
<dl>
<dt style="font-family: monospace;">value</dt>
<dd>The current value of the slider.<br>
<br>
</dd>
<dt><span style="font-family: monospace;">min_value</span><br>
<span style="font-family: monospace;">max_value</span></dt>
<dd>The minimum and maximum values to which the slider can be set. These default to 0.0 and 1.0.<br>
<br>
</dd>
<dt style="font-family: monospace;">action</dt>
<dd>Action to perform when the user changes the value of the slider. See <a href="actions.html">Actions</a>.<br>
<br>
</dd>
<dt style="font-family: monospace;">ticks</dt>
<dd>The number of tick marks to display beside the slider, including
the ones at each end. If this is set to 0, no tick marks will be
displayed. The default is not to show any tick marks.<br>
<br>
</dd>
<dt style="font-family: monospace;">discrete</dt>
<dd>If true, the value of the control is constrained to correspond to one of the tick marks specified with the <span style="font-family: monospace;">ticks</span> property. If false, the value may be set to anything between the <span style="font-family: monospace;">min_value</span> and <span style="font-family: monospace;">max_value</span>. The default is false.<br>
<br>
</dd>
<dt style="font-family: monospace;">live</dt>
<dd>If true, the slider's action will be invoked continuously while
the knob is being dragged. If false, the action will only be invoked
when the mouse is released. The default is true.</dd>
</dl>
</div>
---<br>
</body></html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>StdColors</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></head>
<body>
<h1>module <span style="font-family: monospace;">StdColors</span></h1>
The StdColors submodule provides the following predefined <a href="Color.html">Color</a> instances.<br>
<h2>Global Names</h2>
<tt>black</tt><br>
<tt>dark_grey</tt><br>
<tt>grey</tt><br>
<tt>light_grey</tt><br>
<tt>white</tt><br>
<br>
<tt>red</tt><br>
<tt>green</tt><br>
<tt>blue</tt><br>
<tt>cyan</tt><br>
<tt>magenta</tt><br>
<tt>yellow<br></tt><dl><dt style="font-family: monospace;">selection_forecolor</dt><dd>Foreground colour for highlighting selected items.<br></dd><dt style="font-family: monospace;">selection_backcolor</dt><dd>Background colour for highlighting selected items.</dd><dt></dt></dl>
</body></html>

View File

@ -0,0 +1,61 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>StdCursors</title></head>
<body>
<h1>module <span style="font-family: monospace;">StdCursors</span></h1>
The StdCursors submodule provides a number of predefined <a href="Cursor.html">Cursor</a> instances.<br>
<h2>Global Names</h2>
<table style="text-align: left;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr><td style="font-weight: bold;" align="left" nowrap="nowrap" valign="top">Name</td><td style="font-weight: bold;" align="left" nowrap="nowrap" valign="top"></td><td style="font-weight: bold;" align="left" nowrap="nowrap" valign="top">Description</td><td style="font-weight: bold;" align="left" nowrap="nowrap" valign="top"></td><td style="font-weight: bold;" align="left" nowrap="nowrap" valign="top">Availability</td></tr><tr>
<td style="vertical-align: top;"><span style="font-family: monospace;">arrow</span><br>
</td>
<td style="vertical-align: top; width: 12px;"><br>
</td>
<td style="vertical-align: top;">Standard arrow cursor<br>
</td><td style="vertical-align: top; white-space: nowrap; text-align: left; width: 12px;"></td><td style="vertical-align: top; white-space: nowrap; text-align: left;">All platforms</td>
</tr>
<tr>
<td style="vertical-align: top; font-family: monospace;">ibeam<br>
</td>
<td style="vertical-align: top; width: 12px;"><br>
</td>
<td style="vertical-align: top;">Text-editing cursor<br>
</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">All platforms</td>
</tr>
<tr>
<td style="vertical-align: top; font-family: monospace;">crosshair<br>
</td>
<td style="vertical-align: top; width: 12px;"><br>
</td>
<td style="vertical-align: top;">Thin cross-hairs<br>
</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">All platforms</td>
</tr>
<tr>
<td style="vertical-align: top; font-family: monospace;">fist<br>
</td>
<td style="vertical-align: top; width: 12px;"><br>
</td>
<td style="vertical-align: top;">A hand with the fingers closed<br>
</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">All platforms</td>
</tr>
<tr>
<td style="vertical-align: top; font-family: monospace;">hand<br>
</td>
<td style="vertical-align: top; width: 12px;"><br>
</td>
<td style="vertical-align: top;">A hand with the fingers open<br>
</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">All platforms</td>
</tr>
<tr>
<td style="vertical-align: top; font-family: monospace;">finger<br>
</td>
<td style="vertical-align: top; width: 12px;"><br>
</td>
<td style="vertical-align: top;">A hand with a pointing finger<br>
</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">All platforms</td>
</tr><tr><td align="left" nowrap="nowrap" valign="top"><span style="font-family: monospace;"><a name="invisible"></a>invisible</span></td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">An empty cursor</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">All platforms</td></tr>
<tr><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top">wait</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">Hourglass</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">Windows</td></tr><tr><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top">up_arrow</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">Upward pointing arrow</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">Windows</td></tr><tr><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top">size_all</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">Four-pointed arrow</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">Windows</td></tr><tr><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top">size_w_e</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">Horizontal two-headed arrow</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">Windows</td></tr><tr><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top">size_n_s</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">Vertical two-headed arrow</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">Windows</td></tr><tr><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top">size_nw_se</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">Two-headed arrow from top left to bottom right</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">Windows</td></tr><tr><td style="font-family: monospace;" align="left" nowrap="nowrap" valign="top">size_ne_sw</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">Two-headed arrow from bottom left to top right</td><td align="left" nowrap="nowrap" valign="top"></td><td align="left" nowrap="nowrap" valign="top">Windows</td></tr></tbody>
</table>
<br><span style="font-weight: bold;"><br></span>---<br>
<br>
</body></html>

View File

@ -0,0 +1,19 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>StdFonts</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></head>
<body>
<h1><tt>StdFonts</tt> submodule</h1>
The StdFonts submodule provides the following predefined <a href="Font.html">Font</a> instances.<br><h2>Global Names</h2>
<dl>
<dt><tt>system_font</tt></dt>
<dd>Default font for user interface elements such as menu items and control
titles.</dd>
</dl>
<dl>
<dt><tt>application_font</tt></dt>
<dd>Default font for text entered and edited by the user.</dd>
</dl>
---<br>
</body></html>

View File

@ -0,0 +1,269 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>StdMenus</title>
</head>
<body>
<h1>module <span style="font-family: monospace;">StdMenus</span></h1>
The StdMenus submodule provides facilities for creating menu bars
containing standard menus and menu commands arranged according to
platform conventions. The menus can be customised in a variety of ways:
items can be included or excluded individually or by functional group,
and the titles and keyboard equivalents of selected items can be
overridden.<br>
<h3>Standard menu items</h3>
The standard menu commands &nbsp;and their associated command names
are as follows:<br>
<br>
<table style="text-align: left; margin-left: 40px;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;"><span style="font-weight: bold;">Typical menu text</span><br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top;"><span style="font-weight: bold;">Internal command name</span><br>
</td>
</tr>
<tr>
<td colspan="3" rowspan="1" style="vertical-align: top;"><span style="font-style: italic;"><br>
General commands</span><br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">About <span style="font-style: italic;">app_name</span><br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">about_cmd<br>
</td>
</tr>
<tr>
<td>Help</td>
<td></td>
<td><span style="font-family: monospace;">help_cmd</span></td>
</tr>
<tr>
<td style="vertical-align: top;">Preferences...<br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">preferences_cmd<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Quit<br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">quit_cmd<br>
</td>
</tr>
<tr>
<td colspan="3" rowspan="1" style="vertical-align: top;"><span style="font-style: italic;"><br>
File commands</span><br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">New<br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">new_cmd<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Open...<br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">open_cmd<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Close<br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">close_cmd<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Save<br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">save_cmd<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Save As...<br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">save_as_cmd<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Revert<br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">revert_cmd<br>
</td>
</tr>
<tr>
<td colspan="3" rowspan="1" style="vertical-align: top;"><span style="font-style: italic;"><br>
Editing commands</span><br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Undo<br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">undo_cmd<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Redo<br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">redo_cmd<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Cut<br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">cut_cmd<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Copy<br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">copy_cmd<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Paste<br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">paste_cmd<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Clear<br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">clear_cmd<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">Select All<br>
</td>
<td style="vertical-align: top; width: 10px;"><br>
</td>
<td style="vertical-align: top; font-family: monospace;">select_all_cmd<br>
</td>
</tr>
</tbody>
</table>
<h3><a name="CommandGroups"></a>Command Groups</h3>
To facilitate including or excluding groups of
related commands, the StdMenus module provides the following predefined
command sets that can be used to build values for the <span style="font-family: monospace;">include</span> and <span style="font-family: monospace;">exclude</span>
parameters of the <a href="#basic_menus"><span style="font-family: monospace;">basic_menus()</span></a>
function.<br>
<br>
<table style="text-align: left; margin-left: 40px;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="font-weight: bold;">Group</td>
<td style="width: 10px; font-weight: bold;"></td>
<td style="font-weight: bold;">Commands included</td>
</tr>
<tr>
<td style="font-family: monospace; vertical-align: top;">fundamental_cmds</td>
<td style="font-family: monospace;"></td>
<td><span style="font-family: monospace;">quit_cmd</span><br>
May also include platfom-specific commands that are common to all
applications.</td>
</tr>
<tr>
<td style="font-family: monospace; vertical-align: top;">file_cmds</td>
<td style="font-family: monospace;"></td>
<td style="font-family: monospace;">new_cmd,
open_cmd, close_cmd, save_cmd, save_as_cmd, revert_cmd</td>
</tr>
<tr>
<td style="font-family: monospace; vertical-align: top;">print_cmds</td>
<td style="font-family: monospace;"></td>
<td style="font-family: monospace;">page_setup_cmd,
print_cmd</td>
</tr>
<tr>
<td style="font-family: monospace; vertical-align: top;">pref_cmds</td>
<td style="font-family: monospace;"></td>
<td style="font-family: monospace;">preferences_cmd</td>
</tr>
<tr>
<td style="font-family: monospace; vertical-align: top;">help_cmds</td>
<td style="font-family: monospace;"></td>
<td style="font-family: monospace;">about_cmd,
help_cmd</td>
</tr>
</tbody>
</table>
<br>
<h2>Functions</h2>
<dl>
<dt style="font-family: monospace;"><a name="basic_menus"></a>basic_menus(include = None,
exclude = None, substitutions = {})</dt>
<dd>Returns a <a href="MenuList.html"><span style="font-family: monospace;">MenuList</span></a> containing selected framework-defined
menu
commands, arranged and named according to platform conventions. It is
recommended that you use this as a starting point for defining your own
menu bars.<br>
<br>
The <span style="font-family: monospace;">include</span>
and <span style="font-family: monospace;">exclude</span>
parameters determine which of the standard menu items are included.
Each of them can take either a single command name or a sequence or set
of command names. The menu bar returned will include all of the
standard menu items whose command names are in <span style="font-family: monospace;">include</span> and not
in <span style="font-family: monospace;">exclude</span>.<br>
<br>
If <span style="font-family: monospace;">include</span>
is not specified, it defaults to all of the standard commands.</dd><dd></dd><dd>The <span style="font-family: monospace;">fundamental_cmds</span>
and <span style="font-family: monospace;">edit_cmds</span>
are always included unless you explicitly exclude them via the <span style="font-family: monospace;">exclude</span>
parameter.<br>
<br>
The <span style="font-family: monospace;">substitutions</span>
parameter can be used to override the titles and/or keyboard
equivalents of selected menu items. It takes a mapping from command
names to replacement menu item strings as accepted by the <span style="font-family: monospace;">Menu()</span>
constructor. Each item string may contain a replacement title, a
replacement keyboard equivalent, or both, with standard values being
used for the unspecified parts.</dd>
</dl>
<h2>Variables</h2>
<dl>
<dt style="font-family: monospace;">fundamental_cmds<br>
file_cmds<br>
print_cmds<br>
pref_cmds<br>
help_cmds</dt>
<dd>Predefined <a href="CommandSet.html">CommandSet</a> instances containing <a href="#CommandGroups">groups of
standard command names</a>.</dd>
</dl>
---<br>
<br>
</body></html>

38
PyGUI-2.5.3/Doc/Task.html Normal file
View File

@ -0,0 +1,38 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - Class Task</title></head><body>
<h1>class <span style="font-family: monospace;">Task</span></h1>
A Task enables you to schedule code to be executed after a specified period of time, either once or repeatedly.<br>
<br>
Tasks are intended for applications in which accuracy of timing is not
critical. Tasks are synchronised with the event loop, so if your
application is busy processing an event when a Task becomes ready to
execute, it will be delayed until processing of the event as finished.
Also, on some platforms, Tasks might not run while a menu is being
pulled down or other controls are being interacted with.<br>
<h2>Constructor</h2>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">Task(proc, interval, repeat = False, start = True)</dt>
<dd>Creates a task which will execute the <span style="font-style: italic;">proc</span> after <span style="font-style: italic;">interval</span> seconds. If <span style="font-style: italic;">repeat</span> is true, the task will continue to fire repeatedly every <span style="font-style: italic;">interval</span> seconds, otherwise it will fire only once and then stop. If <span style="font-style: italic;">start</span> is true, the task's timer will be started immediately, otherwise the task will remain dormant until it is activated using the <span style="font-weight: bold;">start()</span> method.<br>
<br>
Arbitrary fractions of a second may be specified for <span style="font-style: italic;">interval</span>, although granularity of timing is platform-dependent. <br>
</dd>
</dl>
<h2>Properties</h2>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">scheduled</dt>
<dd><span style="font-style: italic;">Read only</span> Returns true if the task has been scheduled to run by calling the <span style="font-weight: bold;">start()</span> method or passing true to the <span style="font-weight: bold;">start</span> parameter of the constructor.</dd>
</dl>
<h2>Methods</h2>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">start()</dt>
<dd>Schedules the task for execution and starts its timer. If the task was already scheduled, or was previously unscheduled using <span style="font-weight: bold;">stop()</span> part way through a timing period, the time period is started anew.<br>
<br>
</dd>
<dt style="font-family: monospace;">stop()</dt>
<dd>Stops the task's timer and unschedules it. The task will remain dormant until <span style="font-weight: bold;">start()</span> is called again.</dd>
</dl>
<br>
--<br>
<br>
<br>
</body></html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>TextEditor class</title></head>
<body><h1>class <span style="font-family: monospace;">TextEditor(<a href="Component.html">Component</a>)</span></h1>A&nbsp;TextEditor
provides efficient editing of large amounts of text.<br><br>There may optionally be horizontal and/or vertical scroll bars. If there is no horizontal
scroll bar, text is wrapped to the width of the component.<br><br>Tab stops may be set at regularly-spaced intervals.<br><h2>Constructor</h2><dl style="margin-left: 40px;"><dt style="font-family: monospace;">TextEditor(scrolling = 'hv')</dt><dd>Creates a TextEditor. Presence of scroll bars is controlled by the
<span style="font-style: italic;">scrolling</span> parameter, which is a string containing <span style="font-family: monospace;">'h'</span> for horizontal
and <span style="font-family: monospace;">'v'</span> for vertical.</dd></dl><h2>Properties</h2><dl style="margin-left: 40px;"><dt style="font-family: monospace;">text</dt><dd>The text being edited, as a string.<br><br></dd><dt style="font-family: monospace;">text_length</dt><dd><span style="font-style: italic;">Read only.</span> The number of characters in the text<br><br></dd><dt style="font-family: monospace;">selection</dt><dd>A tuple of indexes (start, end) representing the range of selected characters.<br><br></dd><dt style="font-family: monospace;">font</dt><dd>The <a href="Font.html">Font</a> in which the text is displayed.<br><br></dd><dt style="font-family: monospace;">tab_spacing</dt><dd>Distance between tab stops.</dd></dl><h2>Methods</h2><dl style="margin-left: 40px;"><dt style="font-family: monospace;">select_all()</dt><dd>Selects all of the text.</dd></dl><blockquote> <dl><dt><tt>cut_cmd()</tt></dt><dt><tt>copy_cmd()</tt></dt><dt><tt>paste_cmd()</tt></dt><dt><tt>clear_cmd()<br>select_all_cmd()</tt></dt><dd>These implement the standard editing menu commands. The corresponding
menu items are enabled automatically whenever the component has the keyboard
focus.</dd></dl>
</blockquote><br>---<br></body></html>

View File

@ -0,0 +1,73 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"><title>TextField class</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>class <tt>TextField(Control)</tt></h1>
<p>A&nbsp;TextField is a simple single or multi-line text entry area. All
text in the field is displayed with the same attributes such as font, color and justification.</p>
<h2>Properties</h2>
<dl>
<dl>
<dt><tt>text</tt></dt>
<dd>Contents of the text field.</dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>selection</tt></dt>
<dd>A pair (<span style="font-style: italic;">start, end</span>) indicating the starting and ending character
positions of the selection. Character positions occur between characters
and are numbered from 0.<br>
<br>
<span style="font-style: italic;">Note:</span> This property is
only valid when the text field is the current target. Setting this
property causes the text field to become the target, and the result of
reading it when the text field is not the target is undefined.<br>
</dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>multiline</tt></dt>
<dd><i>Initialize only.</i> A boolean indicating whether multiple lines
can be entered. If false, newline characters typed by the user are not
entered into the text but are passed on to the next handler.</dd>
<dd><br>
</dd>
<dt><tt>password</tt></dt>
<dd><i>Initialize only.</i> A boolean indicating that the text is to
be displayed in an obfuscated manner, as for entering a password.<br>
<br>
</dd>
<dd><i>Note:</i> On some platforms, it may not be possible to combine
this with the <tt>multiline</tt> option.<br></dd></dl></dl><h2>Action Properties</h2><dl><dl><dt style="font-family: monospace;">enter_action</dt><dd>Action
to perform when the Return or Enter key is pressed. (Multiline text
fields only perform this action when the Enter key on the numeric
keypad is used.) The default is <span style="font-family: monospace;">'default_action'</span>.<br><br></dd><dt style="font-family: monospace;">escape_action</dt><dd>Action to perform when the Escape key is pressed. The default is <span style="font-family: monospace;">'cancel_action'</span>.</dd>
</dl>
</dl>
<h2>Methods</h2>
<ul>
</ul>
<blockquote> <dl>
<dt><tt>select_all()</tt></dt>
<dd>Selects all of the text and makes the text field the current target.</dd>
</dl>
</blockquote>
<blockquote> <dl>
<dt><tt>cut_cmd()</tt></dt>
<dt><tt>copy_cmd()</tt></dt>
<dt><tt>paste_cmd()</tt></dt>
<dt><tt>clear_cmd()</tt></dt>
<dd>These implement the standard editing menu commands. The corresponding
menu items are enabled automatically whenever the text field has the keyboard
focus.</dd>
</dl>
</blockquote>
<p>---</p>
<br>
<br>
<br>
<br>
</body></html>

View File

@ -0,0 +1,72 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - GL.Texture class</title>
</head>
<body>
<h1>class <span style="font-family: monospace;">GL.Texture</span></h1>
The Texture class in the GL submodule provides a context-independent
representation of an OpenGL texture. You can use a single Texture
object with multiple GLViews and/or GLPixmaps without being concerned
whether they are sharing texture spaces or not, and without having to
keep track of OpenGL texture numbers.<br>
<br>
Texture is an abstract class. To use it, you subclass it and define the
<span style="font-family: monospace;">do_setup</span>
method to make whatever OpenGL calls are necessary to set up the
texture. Then, when you want to draw with the texture, you call the <span style="font-family: monospace;">bind</span>
method to make it the current OpenGL texture. Whenever the Texture is
used in a context where it has not been used before, your <span style="font-family: monospace;">do_setup</span> method
will be called to create a representation of the texture appropriate to
that context.<br>
<br>
Keep in mind that any call to <span style="font-family: monospace;">bind</span>
can trigger allocation of a texture number and a call to your <span style="font-family: monospace;">do_setup</span>
method, and this will usually happen while you are in the middle of
doing OpenGL drawing. If this would be inconvenient, you may need to
"preload" the texture by calling the <span style="font-family: monospace;">bind</span> method
once in each context where the texture might be used, before you start
drawing.<br>
<h2>Constructor</h2>
<div style="margin-left: 40px;">
<dl>
<dt style="font-family: monospace;">Texture(texture_type)</dt>
<dd>Constructs a texture of the given type. The <span style="font-style: italic;">texture_type</span> should
be one of the OpenGL texture type constants (GL_TEXTURE_2D etc).<br>
</dd>
</dl>
</div>
<h2>Methods</h2>
<div style="margin-left: 40px;">
<dl>
<dt style="font-family: monospace;">bind()</dt>
<dd>Makes this
texture the current texture for the current context by calling
glBindTexture. If this texture has not previously been used
with the current context (or one with which it is sharing
textures), an OpenGL texture number is allocated and <span style="font-family: monospace;">do_setup</span> is
called to initialise a representation of the texture.<br><br></dd><dt style="font-family: monospace;">gl_id()</dt><dd>Returns
the OpenGL texture number corresponding to this texture in the current
context. May trigger allocation of a new texture and a call to <span style="font-family: monospace;">do_setup()</span>.
Does not bind the texture, unless a new texture is allocated, in which
case the current texture binding may be changed as a side effect.<br><br></dd><dt style="font-family: monospace;">gl_tex_image_2d(image, target = GL_TEXTURE_2D, internal_format = GL_RGBA,<br>&nbsp; &nbsp; &nbsp; &nbsp; border = False, with_mipmaps = False)</dt><dd>Loads the currently bound texture with data from an <a href="Image.html">Image</a>. You will typically call this from your <span style="font-family: monospace;">do_setup()</span> method to load the texture data. The image size is scaled up to a power of 2 if necessary. If <span style="font-family: monospace;">border</span> is true, the image will be assumed to have a 1-pixel wide border. If <span style="font-family: monospace;">with_mipmaps</span> is true, a set of mipmaps will be generated using <span style="font-family: monospace;">gluBuild2DMipmaps</span>.<span style="font-style: italic;"> Note:</span> <span style="font-family: monospace;">border</span> and <span style="font-family: monospace;">with_mipmaps</span> cannot both be true.<br></dd>
<dt style="font-family: monospace;">deallocate()</dt>
<dd>Deallocates any OpenGL resources currently allocated to the
Texture. If it is used again, new resources will be allocated.<br>
</dd>
</dl>
</div>
<h2>Abstract methods</h2>
<div style="margin-left: 40px;">
<dl>
<dt style="font-family: monospace;">do_setup()</dt>
<dd>This method should be implemented to make the necessary
OpenGL
calls to initialise the texture. When this method is called, a texture
number will already have been allocated and <span style="font-family: monospace;">glBindTexture</span>
called to make it the current texture.<br>
</dd>
</dl>
</div>
<br>
</body></html>

View File

@ -0,0 +1 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title>PyGUI - class Picture</title> <meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"> </head> <body> <h1>class <tt>Picture(Component)</tt></h1> <p>[NOT YET IMPLEMENTED]<br> </p> <p>A&nbsp;Picture is a component which displays a static PixMap.</p> <h2>Properties</h2> <dl> <dl> <dt><tt>image</tt></dt> <dd>The PixMap to display.</dd> </dl> </dl> <p>---</p> <br> </body> </html>

View File

@ -0,0 +1,203 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"><title>BlobEdit</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>Tutorial</h1>
<p>Here's a quick tutorial to give you an idea of how it all fits together
in practice. It takes the form of an annotated listing of <span style="font-family: monospace;">blobedit.py</span>, a
simple example application included with the source.</p>
<h2>What does BlobEdit do?</h2>
<p>BlobEdit edits Blob Documents. Blob Documents are documents containing
Blobs. Blobs are red squares that you place by clicking and move around
by dragging.</p>
<p>BlobEdit demonstrates how to:</p>
<ol>
<li>Define a Document class for holding a data structure, and an Application
class that deals with it.</li>
<li>Give your Documents the ability to be saved in files, and define a file type for those files.</li>
<li>Define a View class for displaying your data structure, and ensure
that the View is updated whenever the data structure changes.</li>
<li>Write a mouse tracking loop to handle dragging within a View.</li><li>On
MacOSX, build a stand-alone, double-clickable application with file and
application icons and the ability to launch the application by opening
its files.<br>
</li>
</ol>
<p>This tutorial may be extended in the future to cover more features of
the framework.</p>
<h2>Imports</h2>
<p>We'll start by importing the modules and classes that we'll need (using
clairvoyance to determine what they are):</p>
<pre>import pickle<br>from GUI import Application, ScrollableView, Document, Window, \<br> FileType, Cursor, rgb<br>from GUI.Geometry import pt_in_rect, offset_rect, rects_intersect<br>from GUI.StdColors import black, red</pre>
<h2>The Application class</h2>
<p>Because we want to work with a custom Document, we'll have to define our
own subclass of Application.</p>
<pre>class BlobApp(Application):</pre>
<p>The initialisation method will first initialise Application, and then set a few things up.</p>
<pre> def __init__(self):<br> Application.__init__(self)<br></pre>
<div style="margin-left: 40px;">Let's define a file type for our
application's files. Doing this will allow the application to recognise
the files it can open, and on MacOSX it will also allow us to give our
files distinctive icons if we build an application using py2app.
Assigning our file type to the <span style="font-family: monospace;">file_type</span> property will cause it to be used automatically by the <span style="font-weight: bold;">Open</span> and <span style="font-weight: bold;">Save</span> commands.<br>
</div>
<pre> self.file_type = FileType(name = "Blob Document", suffix = "blob")<br></pre>
<div style="margin-left: 40px;">Also, just for fun, let's create a custom cursor to use in our views. Here we're creating a cursor from the image file <span style="font-family: monospace;">"blob.tiff"</span>, which will be looked for in the <span style="font-family: monospace;">Resources</span> directory alongside our main .py file.<br>
</div>
<pre> self.blob_cursor = Cursor("blob.tiff")<br></pre>
<div style="margin-left: 40px;">We're not doing anything with the cursor yet, just storing it away for future use.<br>
</div>
<p>Next, we'll define what our application is to do when it's started
up without being given any files to open. We do this by overriding the <span style="font-family: monospace;">open_app</span> method and having it invoke the <span style="font-weight: bold;">New</span> command to create a new, empty document.<br>
</p>
<pre> def open_app(self):<br>&nbsp; self.new_cmd()</pre>
<p>The <tt>new_cmd</tt> method is the method that's invoked by the standard <span style="font-weight: bold;">New</span> menu command. There's also an <span style="font-family: monospace;">open_cmd</span> method that implements the Open... command. The default implementations of these methods know
almost everything about what to do, but there are a few things we need
to tell them. First, we need to define how to create a Document object of
the appropriate kind. We do this by providing a <tt>make_document</tt>
method:</p>
<pre> def make_document(self, fileref):<br></pre><p>When a new document is being created, this method is called with <span style="font-style: italic;">fileref =</span> <span style="font-family: monospace;">None</span>,
and when an existing file is being opened, it is passed a FileRef.
Since our application only deals with one type of file, we can ignore
the <span style="font-style: italic;">fileref</span> argument. All we have to do is create an instance of our document class
and return it. All further initialization will be done by <tt>new_cmd</tt> or <span style="font-family: monospace;">open_cmd</span>.<br>
</p>
<pre> return BlobDoc()</pre>
<p>Finally, we need to tell our Application how to create a window for viewing
our document. We do this by providing a <tt>make_window</tt> method. This
method is passed the document object for which a window is to be made. Since
our application only deals with one type of document, we know what class it
will be. If we had defined more than one Document class, we would have to
do some testing to find out which kind it was and construct a window accordingly.</p>
<pre> def make_window(self, document):</pre>
<ul>
<p>First, we'll create a top-level Window object and associate it with
the Document. The purpose of associating the Window with the Document is
so that, when the Window is closed, the Document will get the chance to ask
the user whether to save changes.</p>
</ul>
<pre> win = Window(size = (400, 400), document = document)</pre>
<ul>
<p>Next, we'll create a view for displaying our data structure. We'll call
our view class BlobView here and define it later. We make our document the
view's model, so that the view will be notified of any changes that require
it to be redrawn.</p>
</ul>
<pre> view = BlobView(model = document, <br> extent = (1000, 1000), scrolling = 'hv',<br> cursor = self.blob_cursor)</pre>
<ul>
<p>We're intending to make our view class a subclass of ScrollableView so we can scroll it. Here we establish the <span style="font-style: italic;">extent</span> of our view, which is the size of the area that the user will be able to scroll around in, and indicate with the <span style="font-style: italic;">scrolling</span> parameter that it will have both horizontal and vertical scroll bars. We also give it the cursor that we created earlier.<br>
</p></ul>
<ul>
<p>Next we place the view inside the window with options that determine
its position, size and resizing behaviour. Without going deeply into details,
we're saying that the edges of the scroll frame are to initially have offsets
of 0 from the corresponding edges of the window, and that when the window
is resized, the view is to be resized along with it.<br>
</p>
</ul>
<pre> win.place(view, left = 0, top = 0, right = 0, bottom = 0, <br> sticky = 'nsew')</pre>
<ul>
<p>(The options to the <tt>place</tt> method are very flexible, and there's
much more you can do with it than is demonstrated here. See the documentation
for it in the <a href="Container.html#place">Container</a> class for details.)<br>
</p>
<p>Finally, we make the window visible on the screen. (It's easy to forget
this step. If you leave it out, you won't see anything!)</p>
</ul>
<pre> win.show()</pre>
<h2>The Document class</h2>
<p>We'll represent the data structure within our document by means of a <tt>blobs</tt> attribute which will hold a list of Blobs.</p>
<pre>class BlobDoc(Document):<br><br> blobs = None</pre>
<p>We won't define an <tt>__init__</tt> method for the document, because
there are two different ways that a Document object can get initialised.
If it was created by a "New" command, it gets initialised by calling <tt>new_contents</tt>,
whereas if it was created by an "Open..." command, it gets initialised by
calling <tt>read_contents</tt>. So, we'll put our initialisation in those
methods. The <tt>new_contents</tt> method will create a new empty list of
blobs, and the <tt>read_contents</tt> method will use <tt>pickle</tt> to
read a list of blobs from the supplied file.</p>
<pre> def new_contents(self):<br> self.blobs = []<br><br> def read_contents(self, file):<br> self.blobs = pickle.load(file)</pre>
<p>The counterpart to <tt>read_contents</tt> is <tt>write_contents</tt>, which
gets called during the processing of a "Save" or "Save As..." command.</p>
<pre> def write_contents(self, file):<br> pickle.dump(self.blobs, file)</pre>
<p>We'll also define some methods for modifying our data structure. Later
we'll call these from our View in response to user input. After each modification,
we call <tt>self.changed()</tt> to mark the document as needing to be saved,
and <tt>self.notify_views()</tt> to notify any attached views that they need
to be redrawn.</p>
<pre> def add_blob(self, blob):<br> self.blobs.append(blob)<br> self.changed()<br> self.notify_views()<br><br> def move_blob(self, blob, dx, dy):<br> blob.move(dx, dy)<br> self.changed()<br> self.notify_views()<br><br> def delete_blob(self, blob):<br> self.blobs.remove(blob)<br> self.changed()<br> self.notify_views()<br></pre>We'll also find it useful to have a method that searches for a blob given a pair of coordinates.<br>
<pre> def find_blob(self, x, y):<br> for blob in self.blobs:<br> if blob.contains(x, y):<br> return blob<br> return None<br></pre>
<h2>The View class</h2>
<p>Our view class will have two responsibilities: (1) drawing the blobs on
the screen; (2) handling user input actions.</p>
<pre>class BlobView(ScrollableView):</pre>
<p>Drawing is done by the <tt>draw</tt>
method. It is passed a Canvas object on which the drawing should be
done. First, we'll select some colours for drawing our blobs. We're
going to fill them with red and draw a line around them in black. Then
we'll traverse the list of blobs and tell each one to draw itself on
the canvas.</p>
<pre> def draw(self, canvas, update_rect):<br><tt> canvas.fillcolor = red<br> </tt><tt>canvas.pencolor = black</tt><tt><br></tt> for blob in self.model.blobs:<br> if blob.intersects(update_rect):<br> blob.draw(canvas)</pre>
<p>The <span style="font-style: italic;">update_rect</span>
parameter is a rectangle that bounds the region needing to be drawn.
Here we've shown one way in which it can be used, by only drawing blobs
which intersect it. We don't strictly need to do this, since drawing is
clipped to the update_rect anyway, but it can make the drawing process
more efficient. (In this case it may actually make things worse, since
testing for intersection in Python could be slower than letting the
underlying graphics library do the clipping, but the technique is shown
here for illustration purposes.)</p><p>Mouse clicks are handled by the <tt>mouse_down</tt> method. There
are three
things we want the user to be able to do with the mouse. If the click
is
in empty space, a new blob should be created; if the click is within an
existing
blob, it should be dragged, or if the shift key is held down, it should
be deleted. So the first thing we will do is search the blob
list to find out whether the clicked coordinates are within an existing
blob.</p>
<pre>&nbsp; def mouse_down(self, event):<br>&nbsp;&nbsp;&nbsp; x, y = event.position<br>&nbsp;&nbsp;&nbsp; blob = self.model.find_blob(x, y)<br></pre>
If we find a blob, we either drag it around or delete it depending on the state of the shift key.<br>
<pre>&nbsp;&nbsp;&nbsp; if blob:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if not event.shift:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.drag_blob(blob, x, y)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.model.delete_blob(blob)<br></pre>
If not, we add a new blob to the data structure:<ul>
</ul>
<pre>&nbsp;&nbsp;&nbsp; else:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.model.add_blob(Blob(x, y))<br></pre><p>If we're dragging a blob, we need to track the movements of the mouse
until the mouse button is released. To do this we use the <tt>track_mouse</tt> method of class View. <br>
</p>
<p>The <tt>track_mouse</tt> method returns an iterator which produces a series
of mouse events as long as the mouse is dragged around with the button held
down. It's designed to be used in a for-loop like this:<br>
</p>
<pre> def drag_blob(self, blob, x0, y0):<br> for event in self.track_mouse():<br> x, y = event.position<br> self.model.move_blob(blob, x - x0, y - y0)<br> x0 = x<br> y0 = y</pre>
<h2>The Blob class</h2>
<p>Here's the implementation of the Blob class, representing a single
blob.</p>
<pre><tt>class Blob:<br><br> def __init__(self, x, y):<br> self.rect = (x - 20, y - 20, x + 20, y + 20)<br><br> def contains(self, x, y):<br> return pt_in_rect((x, y), self.rect)</tt><br><br> def intersects(self, rect):<br> return rects_intersect(rect, self.rect)<br><br> def move(self, dx, dy):<br> self.rect = offset_rect(self.rect, (dx, dy))<br><br> def draw(self, canvas):<tt><br> l, t, r, b = self.rect<br> canvas.newpath()<br> canvas.moveto(l, t)<br> canvas.lineto(r, t)<br> canvas.lineto(r, b)<br> canvas.lineto(l, b)<br> canvas.closepath()<br></tt><tt> canvas.fill_stroke()</tt></pre>
<h2>Instantiating the application</h2>
Finally, to start everything off, we create an instance of our application
class and call its <tt>run</tt> method. The run method runs the event loop,
and retains control until the application is quit.<br>
<pre>BlobApp().run()</pre>
<h2>Using py2app<br>
</h2>
On MacOSX, while you can quite successfully run BlobEdit as a normal Python script, you may want to go a step further and use <a href="http://undefined.org/python/py2app.html">py2app</a> to create a stand-alone, double-clickable MacOSX application bundle, complete with all the trimmings. There is a <span style="font-family: monospace;">setup.py</span> script in the <span style="font-family: monospace;">Demos/BlobEdit</span> directory of the PyGUI distribution that shows you how to do this. You invoke it with<br>
<div style="margin-left: 40px;">
<pre>python setup.py py2app<br></pre>
</div>
and your application will appear in the <span style="font-family: monospace;">dist</span> directory.<br>
<h2>The End<br>
</h2>
This tutorial will be expanded in the future, but for now, that's all, folks. Happy blobbing!<br>
<br>
<br>
</body></html>

106
PyGUI-2.5.3/Doc/View.html Normal file
View File

@ -0,0 +1,106 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"><title>View class</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>class <tt>View(<a href="Container.html">Container</a>,</tt> <tt><a href="ViewBase.html">ViewBase</a>, <a href="Printable.html">Printable</a>)</tt></h1>
<p>Class View is a general-purpose component
for displaying 2D graphics and handling mouse and keyboard input. It
also provides special support
for being an observer of one or more <a href="Model.html">Models</a>.<br>
</p>
<p>This page documents properties and methods concerned with drawing. See
<a href="ViewBase.html">ViewBase</a> for information about input handling
and model observation.<br>
</p><h2>Abstract methods</h2>
<blockquote> <dl>
<dt><tt>draw(</tt><i>canvas, update_rect</i><tt>)</tt></dt>
<dd>Called when some or all of the view needs to be drawn. The <i>canvas
</i>parameter is an object of class <a href="Canvas.html">Canvas</a>
upon which the drawing should be done. The <span style="font-style: italic;">update_rect</span> is the rectangle in the view's coordinate system that needs drawing.<br>
<br>
You can use the update_rect to improve efficiency by only drawing parts
of the view that lie within it, although this is optional. Drawing will
be clipped to the update_rect in any case.<br><br>The <span style="font-family: monospace;">printing</span>
property of the canvas can be used to determine whether to draw
features, such as selection highlighting, that should only appear on
the screen and not on a printed page.<br>
<br>
<span style="font-style: italic;">Note:</span> The canvas is only valid for the duration
of this call and should not be retained beyond it. To draw into the view
at other times, use the <tt>with_canvas</tt> method.</dd>
<dd><br>
</dd>
<dt><tt>resized((</tt><i>dw</i><tt>,</tt> <i>dh</i><tt>))</tt></dt>
<dd>Called whenever the size of the view changes as a result of the user
resizing the containing window.</dd>
<dd><br>
</dd>
<dt><tt>container_resized((</tt><i>dw</i><tt>,</tt> <i>dh</i><tt>))</tt></dt>
<dd>Called whenever the view's container changes size as a result of the
user resizing the containing window. The default implementation of this
method adjusts the position and size of this component according to the
settings of its resizing attributes.</dd>
</dl>
</blockquote>
<dl>
<h2>Methods</h2>
</dl>
<blockquote> <dl>
<dt><tt>viewed_rect()</tt></dt>
<dd>Returns the viewed rectangle, i.e. the rectangle in local coordinates
that is currently visible in the view.<br>
</dd>
<dd><br>
</dd>
<dt><tt>invalidate()</tt></dt>
<dd>Marks the whole viewed rectangle as needing to be redrawn.</dd>
<dd>&nbsp;</dd>
<dt><tt>invalidate_rect(</tt><i>rect</i><tt>)</tt></dt>
<dd>Mark the given rectangle, in local coordinates, as needing to be
redrawn.</dd>
</dl>
<dl>
<dt><tt>update()</tt></dt>
<dd>Causes invalidated areas to be redrawn immediately, without waiting
for a return to the event loop.<br>
</dd>
<dd><br>
</dd>
<dt><tt>with_canvas(</tt><i>function</i>)</dt>
<dd>The function should be a callable object expecting one parameter.
The function is called with a <a href="Canvas.html">Canvas</a> instance
for drawing in the view. The canvas is only valid for the duration of the
call and should not be retained beyond it.</dd>
<dd>&nbsp;</dd><dt><tt>local_to_global(</tt><i>p</i><tt>)</tt></dt>
<dd>Transforms the given point from the view's local coordinate system
to screen coordinates.</dd>
<dd><br>
</dd>
<dt><tt>global_to_local(</tt><i>p</i><tt>)</tt></dt>
<dd>Transforms the given point from screen coordinates to the view's local
coordinate system.</dd>
<dd><br>
</dd>
<dt><tt>local_to_container(</tt><i>p</i><tt>)</tt></dt>
<dd>Transforms the given point from the view's local coordinate system
to its container's local coordinate system.</dd>
<dd><br>
</dd>
<dt><tt>container_to_local(</tt><i>p</i><tt>)</tt></dt>
<dd>Transforms the given point from the view's container's local coordinate
system to the view's local coordinate system.</dd>
<dd><br>
</dd></dl>
</blockquote>
<dl>
---<br>
<br>
</dl>
<br>
<br>
<br>
<br>
<br>
<br>
</body></html>

View File

@ -0,0 +1,112 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>ViewBase</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<h1>class <tt>ViewBase</tt></h1>
ViewBase is an abstract class providing common functionality for
user-defined views. It provides facilities for associating
the view with one or more <a href="Model.html">Models</a>,
and some default
behaviour for responding to changes in a model.<br>
<br>
ViewBase is not intended to be used directly as a base class. Usable
subclasses of ViewBase include <a href="View.html">View</a>
and <a href="GLView.html">GLView</a>.<br>
<h2>Properties</h2>
<blockquote>
<dl>
<dt><tt>models</tt></dt>
<dd>List of models being observed. <i>Do not modify
this list directly.</i> Use the <tt>add_model</tt>
and <tt>remove_model</tt> methods to attach and detach
models.</dd>
<dd><br>
</dd>
<dt><tt>model</tt></dt>
<dd>Convenience property for when only one model is being
observed. Reading this property returns <tt>models[0]</tt>
when models is not empty, otherwise it returns <tt>None</tt>.
Assigning a model to this property removes all other models and adds it
as the sole model. Assigning <tt>None</tt> to this
property removes all models.<br>
<br>
</dd>
<dt style="font-family: monospace;"><a name="cursor"></a>cursor</dt>
<dd>The <a href="Cursor.html"><span style="font-family: monospace;">Cursor</span></a>
to display when the mouse is over the view, or <span style="font-family: monospace;">None</span> to use the
default cursor.</dd>
<dd></dd>
<dd>To prevent any cursor from being shown over this view,
set the <span style="font-family: monospace;">cursor</span>
property to <a href="StdCursors.html#invisible"><span style="font-family: monospace;">StdCursors.invisible</span></a>.<br>
</dd>
</dl>
</blockquote>
<h2>Abstract methods&nbsp;<br>
</h2>
<blockquote>
<dl>
<dt><tt>model_changed()</tt></dt>
<dd>Called when an attached model's <tt>notify_view</tt>
method is called without specifying a message name. The default action
is to call the
view's <tt>invalidate</tt> method.</dd>
<dd><br>
</dd>
<dt><tt>model_destroyed(</tt><i>model</i><tt>)</tt></dt>
<dd>Called when an attached model is destroyed. The default
action is to destroy the window containing this view, if any.<br>
<br>
<i>Note:</i> The model parameter should only be used
to identify which model is being destroyed, if the view is observing
more than one model. Do not rely on the state of the model object that
is being destroyed.<br><br>
</dd>
<dt><tt>targeted()</tt></dt>
<dd>Called whenever this view becomes the current message
target in a visible window.<br>
<br>
</dd>
<dt style="font-family: monospace;">untargeted()</dt>
<dd>Called whenever this view ceases to be the current
message target in a visible window.<br>
</dd>
</dl>
</blockquote>
<dl>
<h2>Methods</h2>
</dl>
<blockquote>
<dl>
<dt><tt>add_model(</tt><i>model</i><tt>)</tt></dt>
<dd>Attaches a model to this view, so that the view will be
notified of
changes to the model. This is an alternative to calling the model's <tt>add_view</tt>
method.</dd>
<dd><br>
</dd>
<dt><tt>remove_model</tt><tt>(</tt><i>model</i><tt>)</tt></dt>
<dd>Detaches a model from this view. This is an alternative
to calling the model's <tt>remove_view</tt> method.</dd>
</dl>
</blockquote>
<blockquote>
<dl>
<dt><tt>track_mouse()</tt></dt>
<dd>Called following the receipt of a mouse-down event,
returns an iterator which yields a series of mouse-drag events as long
as the mouse button is held down, followed by a mouse-up event. The
positions of all events are reported in the view's local coordinate
system. While the iterator is active, all mouse movement events are
reported, whether they occur within the view's bounds or not, and any
other user input events are ignored.</dd>
</dl>
</blockquote>
<dl>
<dd>&nbsp;</dd>
</dl>
<br>
<br>
</body></html>

224
PyGUI-2.5.3/Doc/Window.html Normal file
View File

@ -0,0 +1,224 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"><title>Window</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>class <tt>Window(<a href="Container.html">Container</a>)</tt></h1>
<p>A&nbsp;Window is a top-level component. In order to be visible on the screen,
a component must be directly or indirectly contained in a window.</p>
A newly-created window is initially hidden so that components can
be added to it without unsightly flashing. Once constructed, it should be
shown using the <tt>show</tt> method.<br><h3>Size and position</h3>The geometry properties of a window govern the size and position of the window's <span style="font-style: italic;">content</span>
area relative to the screen. Usually there will be borders, a title bar
and so forth existing outside this area, and on some platforms there
will also be a menu bar between the title and the content area. These
things should be kept in mind if you are setting the position of a
window explicitly. For example, trying to place a window in the top
left corner of the screen by setting its position to (0, 0) will
probably not work as expected, as it will result in the title bar and
menus being hidden. <span style="font-style: italic;">(There is
currently no good way of dealing with this; as a rule of thumb, allow 5
pixels to the left and 40 pixels above to accommodate window
decorations.)</span><br>
<br>
The initial position of a window is determined in a platform-dependent
way, and may not correspond to the initial values of its <tt>x</tt> and
<tt>y</tt> properties. For example, standard-style windows might be staggered
and dialog-style windows might be centred on the screen. However, once the
window has been shown for the first time, the <tt>x</tt> and <tt>y</tt> properties
will reflect its actual screen position, and changing them will move the
window to the specified position.<br>
<h3>Menus</h3>
A window can be given a list of window-specific menus that are to be available
(along with the application-wide menus) only when that window is active.
The manner in which these menus are presented is platform-dependent.<br>
<h3>Document association</h3>
A window can be associated with a document. When this is done, the behaviour
of the window changes in the following ways:<br>
The window's title will (by default) be derived automatically from the document's
title.<br>
<ul>
<li>The document becomes the window's <i>next handler</i> for keyboard
events and menu commands.</li>
<li>An attempt by the user to close the window is taken as a request to
close the associated document, which may trigger a dialog asking whether
to save changes.</li>
<li>Closing the document causes all its associated windows to be destroyed.</li>
</ul>
<h2>Constructor</h2>
<blockquote>
<dl>
<dt><tt>Window(style</tt> <tt>=</tt> <tt>'standard',</tt></dt>
<dt><tt>&nbsp; movable</tt> <tt>=</tt> <i>default</i><tt>, closable</tt>
<tt>=</tt>&nbsp;<i>default</i>,<tt> hidable</tt> =&nbsp;<i>default</i><tt>,</tt></dt>
<dt><tt>&nbsp; resizable</tt> <tt>=</tt>&nbsp;<i>default</i>,<tt> zoomable</tt>
=&nbsp;<i>default</i><tt>)</tt></dt>
<dd><br>
</dd>
<dd>The <i>style</i> parameter determines the appearance of the window,
according to platform conventions. It is one of:</dd>
</dl>
</blockquote>
<blockquote>
<dl>
<dd> <ul>
<li><tt>'standard'</tt></li>
<li><tt>'nonmodal_dialog'</tt></li>
<li><tt>'modal_dialog'</tt></li>
<li><tt>'alert'</tt></li><li><tt>'fullscreen'<br></tt></li>
</ul>
</dd>
<dd><br>
</dd>
<dd>Not all of these styles are necessarily distinguishable on all platforms.</dd>
<dd><br>
</dd>
<dd> Note that the <span style="font-family: monospace;">'modal_dialog'</span>and <span style="font-family: monospace;">'alert'</span> styles only affect the <i>appearance</i> of the
window; they do not in themselves cause the window to behave modally. For a window
with modal behaviour, use a <a href="ModalDialog.html">ModalDialog</a> or one of the <a href="alert_funcs.html">alert functions</a>.</dd>
<dd><br>
</dd>
<dd>The options<span style="font-family: monospace;">'movable'</span>, <span style="font-family: monospace;">'closable'</span>, <span style="font-family: monospace;">'resizable'</span>, <span style="font-family: monospace;">'hidable'</span>(minimizable)<span style="font-family: monospace;"></span> and <span style="font-family: monospace;">'zoomable'</span>(maximizable) request
the presence or absence of controls for performing these functions. The default
values of these options depend on the window style in a platform-dependent
way. Some combinations of styles and options may not be available, in which case you will get the nearest available combination.</dd>
</dl><div style="margin-left: 40px;">A <span style="font-family: monospace;">'fullscreen'</span>
window is created without any title, borders or other decoration, and
with an initial size and position that covers the whole screen. The
effect of changing a fullscreen window's size or position is undefined.
On MacOSX, the menu bar is hidden when a fullscreen window is the
active window.<br><br><span style="font-style: italic;">Note: the <span style="font-weight: bold;">fullscreen</span> style is currently not implemented on Gtk.</span></div>
</blockquote>
<h2>Properties</h2>
<blockquote> <dl>
<dt><tt>title</tt></dt>
<dd>Title of the window. Whether and how the title is displayed depends
on the window style and platform conventions.</dd>
<dd><br>
</dd>
<dt><tt>document</tt></dt>
<dd>The Document instance to which this window belongs, if any.</dd>
<dd><br>
</dd>
<dt><tt>menus</tt></dt>
<dd>List of window-specific menus, i.e. those which should be available
only when this window is active.<br>
<br>
</dd>
<dd><i>Do not modify the contents of this list.</i> To change it, you
should construct a new list of menus and then assign the whole list to this
property.<br>
<br>
</dd><dt style="font-family: monospace;">visible</dt>
<dd>True if the window is shown on the screen. The visibility of the window can&nbsp; be changed using the <span style="font-family: monospace;">show</span> and <span style="font-family: monospace;">hide</span> methods, or by assigning to this property. The effect on window stacking order of assigning true to this property is undefined.<br>
<br>
</dd>
<dt style="font-family: monospace;">auto_position</dt>
<dd>If true, the window will be positioned automatically the first
time it is shown. The method of positioning depends on the platform and
the style of the window. Typically, dialog windows will be centred on
the screen, and other windows will be staggered or the user will be
asked to place them.<br>
<br>
If false, the initial position of the window is determined by the settings of its geometry properties.<br>
<br>
</dd>
<dt style="font-family: monospace;">target</dt>
<dd><span style="font-style: italic;">Read only</span>. The component within the window, if any, that is currently the target of keyboard events and menu commands. <span style="font-style: italic;">May not be implemented on all platforms.</span><br>
</dd>
</dl>
</blockquote>
<h2>Attributes</h2>
<div style="margin-left: 40px;">
<dl>
<dt style="font-family: monospace;">keeps_document_open</dt>
<dd>A
boolean controlling whether the presence of this window keeps its
associated document open. When a window is closed, and its document has
no other window whose <span style="font-family: monospace;">keeps_document_open</span>
flag is true, the document and any other remaining windows for it are
closed. Defaults to true. May be specified as a class attribute.<br>
</dd>
</dl>
</div>
<h2>Methods</h2>
<dl>
<dl>
<dt><tt>show()</tt></dt>
<dd>Makes the window visible on the screen (by setting the <tt>visible</tt>
property to true), and brings it to the front. </dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>hide()</tt></dt>
<dd>Temporarily removes the window from the screen. Equivalent to setting
the <tt>visible</tt> property to false.</dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>bring_to_front()</tt></dt>
<dd>Moves the window to the front of the stacking order. [NOT&nbsp;YET&nbsp;IMPLEMENTED]</dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>send_to_back()</tt></dt>
<dd>Moves the window to the back of the stacking order. [NOT&nbsp;YET&nbsp;IMPLEMENTED]</dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>place_behind(window)</tt></dt>
<dd>Places the window just behind the given window in the stacking order.
[NOT&nbsp;YET&nbsp;IMPLEMENTED]</dd>
</dl>
</dl><dl style="margin-left: 40px;"><dt style="font-family: monospace;">modal_event_loop()</dt><dd>Runs an event loop, fetching and handling input events for this window
until <span style="font-family: monospace;">exit_modal_event_loop()</span>
is called. Interaction with other windows is prevented.<br>
<br>
If a <span style="font-family: monospace;">Cancel</span>
exception is raised during the event loop, it is silently caught and
the event loop continues. The handling of an exception of any other
type is platform-dependent; it may break the event loop and be
propagated, or it may be handled within the loop using the application's <a href="Application.html#report_exception"><span style="font-family: monospace;">report_exception()</span></a> method.<br><br></dd><dt style="font-family: monospace;">exit_modal_event_loop()</dt><dd>Causes the current call to <span style="font-family: monospace;">modal_event_loop()</span><span style="font-family: monospace;"></span> to
exit.</dd></dl><dl><h2>Abstract methods</h2>
<dl>
<dt><tt>update_title()</tt></dt>
<dd>Called when the title of the document owning this window changes.
By default it changes the window title to match the document title.</dd>
</dl>
</dl>
<dl>
<dl>
<dt><tt>close_cmd()</tt></dt>
<dd>Called in response to the <b>Close </b>menu command, or by activation
of whatever gadget is used to close a window on the platform concerned.
If the window belongs to a document and the document does not own any other
windows, the document's <tt>close_cmd</tt> method is called. In any other
case, the <tt>destroy </tt>method of this window is called.</dd>
</dl>
</dl>
<h2>Destructor</h2>
<dl>
<dl>
<dt><tt>destroy()</tt></dt>
<dd>Permanently removes the window from the screen, dissociates it from
any document, and recursively destroys any sub-components. Neither the
window nor any of its sub-components should be used again.</dd>
<dd><br>
</dd>
<dd>All windows and other components should be destroyed when they are
no longer needed, otherwise they may not be garbage collected properly and
may continue to tie up window system resources. This is taken care of by
the framework when the user closes a window or document. In other situations
you may need to call the <tt>destroy</tt> method yourself.<br>
</dd>
</dl>
</dl>
<br>
<br>
</body></html>

View File

@ -0,0 +1 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>PyGUI - Actions</title> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> </head> <body> <h1>Actions</h1> Some PyGUI classes have one or more <i>action properties</i>. An action property specifies an action to perform in response to something done by the user, e.g. clicking a button.<br> <br> The value of an action property can take any of the following forms:<br> <ul> <li>A <i>function</i> (or other callable object)</li> <li>A tuple <tt>(</tt><i>function</i><tt>,</tt> <i>arg</i><tt>,</tt> ...<tt>)</tt></li> <li>A <i>message name</i> specifying a message to be sent up the message handling hierarchy</li> <li>A tuple <tt>(</tt><i>message</i><tt>,</tt> <i>arg</i><tt>,</tt> ...<tt>)</tt><br> </li> </ul> <h2>Invoking actions programmatically</h2> As a general principle, action properties are only triggered in response to actions performed by the user, not actions performed by the program. For example, the <tt>action</tt> property of a CheckBox is triggered when the user clicks on the check box, but not when the <tt>on</tt> property of the check box is assigned to by program code. This makes it easier to set up actions which keep different controls in sync with each other without inadvertently creating infinite loops.<br> <br> If you do want an action performed in response to program code, you will need to trigger it explicitly. Corresponding to each action property <tt>xxx_action</tt> there is a method called <tt>do_xxx_action</tt> which invokes the action. For example, here is how you can change the <tt>on</tt> property of a check box and trigger the action as though the user had clicked on the control:<br> <blockquote><tt>my_checkbox.on = True</tt><br> <tt>my_checkbox.do_action()</tt><br> </blockquote> <h2>Overriding actions in subclasses</h2> If you subclass a component and want the subclass to provide an action for one of the superclass's action properties, there are a couple of ways you can go about it. One is to simply pass a bound method of the subclass as the initial value of the action property when calling the superclass's __init__ method. This is not the best way, however, since it uses up the action slot and precludes the possibility of users of your class using it to further customise the component's behaviour. Worse, if the user doesn't realise the action slot is already in use and plugs in an action of his own, it will supplant your subclass's action, which is probably not what you want.<br> <br> A better way is to override the <tt>do_action</tt> method for the action. This ensures that users of your class can't inadvertently wipe out your action, and leaves the action property open for further customisation, which you can allow by calling the superclass's <tt>do_action</tt> method from yours. For example,<br> <blockquote><tt>class MyControl(SomeControl):</tt><br> <br> <tt>&nbsp;&nbsp;&nbsp; def do_action(self):</tt><br> <tt>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ...do something special here, and then...</tt><br> <tt>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; SomeControl.do_action(self) # give user's action a go</tt><br> </blockquote> <br> ---<br> <br> </body> </html>

View File

@ -0,0 +1,138 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>Alert Functions</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]">
</head>
<body>
<h1>module <span style="font-family: monospace;">Alerts</span></h1>
This module defines functions that display various commonly-used types
of modal dialog containing a textual message.<br>
<h2>Alert kinds</h2>
The <tt>kind</tt> parameter in the following functions
determines the appearance of the dialog. It may take the following
values:<br>
<blockquote>
<dl>
<dt><tt>'stop'</tt></dt>
<dd>Used for displaying an error message or other condition
which prevents an operation from being completed.</dd>
</dl>
<dl>
<dt><tt>'caution'</tt></dt>
<dd>Used for warning the user when an operation could cause
loss of data or other undesirable effects.</dd>
</dl>
<dl>
<dt><tt>'note'</tt></dt>
<dd>Used for presenting an informational message to the user.</dd>
</dl>
<dl>
<dt><tt>'query'</tt></dt>
<dd>Used for requesting information from the user.</dd>
</dl>
</blockquote>
Some platforms may not display all of these in a unique way.<br>
<h2>Functions<br>
</h2>
<h3>Low-level alert functions</h3>
<dl>
<dt><tt>alert(kind, message, ok_label = "OK")</tt></dt>
<dd>Displays an alert box with one button, which is the default
button.
Does not return a value.</dd>
<dl>
</dl>
</dl>
<dl>
<dt><tt>alert2(kind,&nbsp;</tt><tt>message</tt><tt>,
yes_label = "Yes", no_label = "No",</tt></dt>
<dt><tt>&nbsp; &nbsp; &nbsp;
&nbsp;default = 1, cancel = 0)</tt></dt>
<dd>Displays an alert box with two buttons. Returns 1 if the
"yes" button is pressed, 0 if the "no" button is pressed. The <tt>default</tt>
and <tt>cancel</tt>&nbsp;parameters&nbsp;specify
which buttons, if any, are activated by the standard keyboard
equivalents,
and take the values <tt>1</tt>, <tt>0</tt> or
<tt>None</tt>.</dd>
<dl>
</dl>
</dl>
<dl>
<dt><tt>alert3(kind, message, yes_label = "Yes", no_label
= "No", <br>
&nbsp; &nbsp; &nbsp; &nbsp;other_label = "Cancel", </tt><tt>default
= 1,
cancel = -1</tt><tt>)</tt></dt>
<dd>Displays an alert box with three buttons. Returns 1 if the
"yes" button
is pressed, 0 if the "no" button is pressed, and -1 if the "other"
button
is pressed.&nbsp; The <tt>default</tt> and <tt>cancel</tt>
parameters specify
which buttons, if any, are activated by the standard keyboard
equivalents,
and take the values <tt>1</tt>, <tt>0</tt>, <tt>-1</tt>
or <tt>None</tt>.</dd>
<dl>
</dl>
</dl>
In addition to the parameters listed above, these functions also accept
the
following optional parameters:<br>
<blockquote>
<dl>
<dt><tt>width</tt></dt>
<dd>The overall width of the alert box.</dd>
</dl>
<dl>
<dt><tt>lines</tt></dt>
<dd>The number of lines to allow for in the text area of the
alert box.</dd>
</dl>
</blockquote>
These parameters are hints only; platforms are free to
ignore them and calculate the size of the alert box from the text
provided.<br>
<h3>High-level alert functions</h3>
The following functions provide shorthands for calling the above
functions
with certain common combinations of parameters.<br>
<dl>
<dt><tt>note_alert(message,</tt> ...<tt>)</tt></dt>
<dd>Equivalent to <tt>alert('note', message,</tt>
...<tt>)</tt>.</dd>
<dl>
</dl>
</dl>
<dl>
<dt><tt>stop_alert(message,</tt> ...<tt>)</tt></dt>
<dd>Equivalent to <tt>alert('stop', message,</tt>
...<tt>)</tt>.</dd>
</dl>
<dl>
<dt><tt>ask(message,</tt> ...<tt>)</tt></dt>
<dd>Equivalent to <tt>alert2('query', message,</tt>
...<tt>)</tt>.</dd>
<dl>
</dl>
</dl>
<dl>
<dt><tt>confirm(message,</tt> ...<tt>)</tt></dt>
<dd>Equivalent to <tt>alert2('caution', message,</tt>
...<tt>)</tt>.</dd>
</dl>
<dl>
<dt><tt>ask_or_cancel(message,</tt> ...<tt>)</tt></dt>
<dd>Equivalent to <tt>alert3('query', message,</tt>
...<tt>)</tt>.</dd>
</dl>
<dl>
<dt><tt>confirm_or_cancel(message,</tt> ...<tt>)</tt></dt>
<dd>Equivalent to <tt>alert3('caution', message,</tt>
...<tt>)</tt>.</dd>
</dl>
---<br>
<br>
</body></html>

View File

@ -0,0 +1,24 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title></title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>Global Functions</h1>
<dl>
<dt><tt><a name="application"></a>application()</tt></dt>
<dd>Returns the Application instance. The first time an instance of Application
or a subclass of Application is created, a global reference to it is stored;
the <tt>application</tt> function returns this reference.</dd>
<dd>If this function is called before any Application object has been created,
it creates an instance of class Application automatically.<br>
<br>
</dd><dt style="font-family: monospace;"><a name="run"></a>run()</dt>
<dd>Runs the application. This is equivalent to <span style="font-family: monospace;">application().run()</span>. Retains control until the application is quit.</dd>
</dl>
</body></html>

Binary file not shown.

View File

@ -0,0 +1,33 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>PyGUI - Coordinates, Points and Rectangles</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></head>
<body>
<h1> Coordinates, Points and Rectangles<br>
</h1>
The coordinate system of a Window or View has (0, 0) at the top left corner,
with <i>x</i> coordinates increasing to the right and <i>y</i> coordinates
increasing downward. The coordinates label infinitely thin horizontal and
vertical lines, and pixels exist between these lines, as illustrated in the
figure below.<br>
<br>
A <b>point</b> is represented by a 2-tuple (<i>x, y</i>). A 2-tuple can also
be used to represent as size (<i>width, height</i>) or a relative displacement
(<i>dx, dy</i>).<br>
<br>
A <b>rectangle</b> is represented by a 4-tuple (<i>left, top, right, bottom</i>).
If <i>right</i> &lt;= <i>left</i> or <i>bottom</i> &lt;= <i>top</i>, the
rectangle is an <i>empty rectangle</i> and is considered to enclose no pixels.<br>
<br>
<b>Angles</b> are measured in degrees <i>anticlockwise</i> from the <i>x</i>-axis.<br>
<br>
The <a href="Geometry.html">Geometry</a> submodule provides a collection
of functions for operating on points and rectangles.<br>
<br>
<div align="center"><img src="coordinates.jpg" alt="" height="360" width="576">
<br>
<small><font face="Helvetica, Arial, sans-serif">Relationship between coordinates,
pixels, points and rectangles</font></small><br>
</div>
</body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -0,0 +1,88 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - Customising the Standard Menus</title></head>
<body>
<h1>Customising the Standard Menu Bar<br>
</h1>
By default, a PyGUI application comes with a standard set of menus
containing all the commands that the PyGUI framework itself knows about
- Open, Close, Save, Cut, Copy, Paste and so forth. It's likely that
you won't use all of these commands in your application, will want to
omit some of them. It's also likely that you will want to add new
commands of your own. PyGUI offers a variety of mechanisms to do these
things in a platform-independent way.<br><h2>Choosing standard menu items</h2>The <a href="StdMenus.html#basic_menus"><span style="font-family: monospace;">basic_menus()</span></a> function from the <a href="StdMenus.html"><span style="font-family: monospace;">StdMenus</span></a>
module provides a starting point for building your application's main
menu bar. Without any parameters, it returns a list of menus containing
all of the standard commands, arranged according to platform
conventions.<br><br>If you want to be more selective, there are a
couple of ways to go about it. One is to start with all the standard
items and take away the ones you don't want using the <span style="font-family: monospace;">exclude</span>
parameter, which takes a sequence or set of command names. The StdMenus
module exports a number of predefined command sets to make this easier.
For example, the following creates a menu bar containing all the
standard commands except those having to do with files or printing.<br><br><div style="margin-left: 40px;"><span style="font-family: monospace;">from GUI.StdMenus import basic_menus, file_cmds, print_cmds</span><br style="font-family: monospace;"><span style="font-family: monospace;">menus = basic_menus(exclude = file_cmds + print_cmds)</span><br></div><br>The menu bar is installed by assigning it to the <span style="font-family: monospace;">menus</span> property of the application.<br><br><div style="margin-left: 40px;"><span style="font-family: monospace;">app = MyApplication()<br>app.menus = menus<br></span></div>
<br>The other way is to start with a minimal set of commands and add the extra ones that you want using the <span style="font-family: monospace;">include</span> parameter. When you specify a value for <span style="font-family: monospace;">include</span>, the menu bar will include only those items, plus the <span style="font-family: monospace;">fundamental_cmds</span> and <span style="font-family: monospace;">edit_cmds</span>,
which are considered essential for most applications. The following
creates a menu bar containing only the file-related commands and the
"Preferences" command in addition to the essential ones.<br><br><div style="margin-left: 40px;"><span style="font-family: monospace;">menus = basic_menus(include = file_cmds + prefs_cmds)</span><br></div><br>You can use both <span style="font-family: monospace;">include</span> and <span style="font-family: monospace;">exclude</span>
together; this is the only way to omit items from the essential set.
The following includes all of the file-related commands except
"Revert", and also omits the "Redo" command, which would otherwise be
implicitly included because it is part of the <span style="font-family: monospace;">edit_cmds</span> set.<br><br><div style="margin-left: 40px;"><span style="font-family: monospace;">menus = basic_menus(include = file_cmds, exclude = ['revert_cmd', 'redo_cmd'])</span><br></div><br>Note,
however, that it is generally a bad idea to exclude items from the
essential set. On some platforms, for example, the editing commands
need to be present in the menus in order for their keyboard equivalents
to work in dialogs.<br><h2>Modifying standard menu items</h2>Sometimes
you will want to give different titles or keyboard equivalents to
standard menu commands. For example, in a game you might want the New,
Open and Save commands to be called "New Game", "Load Game" and "Save
Game", and give "Load Game" a keyboard equivalent of "L" instead of "O".<br><br>You can do this easily using the <span style="font-family: monospace;">substitutions</span> parameter to <span style="font-family: monospace;">basic_menus()</span>. It takes a dictionary whose keys are command names and values are replacement menu item strings. For example:<br><br><div style="margin-left: 40px;"><span style="font-family: monospace;">menus = basic_menus(substitutions = {</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp; 'new_cmd': &nbsp; &nbsp; "New Game",</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp; 'open_cmd': &nbsp; &nbsp;"Load Game.../L",</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp; 'save_cmd': &nbsp; &nbsp;"Save Game",</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp; 'save_as_cmd': "Save Game As..."})</span><br></div><br>Each
replacement can override just the title, just the keyboard equivalent,
or both. In the above example, the keyboard equivalent of <span style="font-family: monospace;">open_cmd</span> is overridden, but the other commands are left with their standard equivalents.<h2>Adding menus</h2>
The simplest way to add new commands is to create one or more extra menus containing your
commands, and add them to the end of the application's menu bar. Here's
an example of how to do this.<br>
<br>
<div style="margin-left: 40px;"><span style="font-family: monospace;">menus = basic_menus()</span><br style="font-family: monospace;">
<span style="font-family: monospace;">my_menu = Menu("Widget", [("Swizzle", 'swiz_cmd'), ("Defibrillate", 'defib_cmd')])</span><span style="font-family: monospace;"></span><span style="font-family: monospace;"></span><span style="font-family: monospace;"></span><br style="font-family: monospace;">
<span style="font-family: monospace;">menus.append(my_menu)</span><span style="font-family: monospace;"></span><br style="font-family: monospace;">
<span style="font-family: monospace;">app.menus =&nbsp;menus</span><br>
</div>
<br>
Note that the new menu is added to the menu list <span style="font-style: italic;">before</span> assigning the menu list to the application's <span style="font-family: monospace;">menus</span> property. This is important, to ensure that the menu bar is updated properly.<br>
<h2>Adding commands to standard menus</h2>
Adding your own menus is all well and good, but you may want more
control than that. For example, if you have some editing-related
commands, you might want to add them to the Edit menu instead of
putting them in a menu of their own.<br>
<br>
The problem with this is finding the right menu to add them to. PyGUI
tries to make as few assumptions as possible about the layout of the
standard menus, and if you want your application to be portable, you
should do the same. So you shouldn't assume, for example, that the Edit
menu is the second menu in the menu bar. (On the Mac, it's not!) You
shouldn't even assume that there will <span style="font-style: italic;">be</span> an Edit menu at all.<br>
<br>
Rather than a particular menu, it's better to think in terms of putting
your commands near existing commands. PyGUI helps you out here by means
of the <a href="MenuList.html">MenuList</a> class. A
MenuList is just like an ordinary list, except that it also has a
method that will take an internal command name and give you the menu
which contains that command. So we can find the menu containing, say,
the <span style="font-family: monospace;">'copy_cmd'</span> command,
and be fairly sure that it's the Edit menu, or whatever passes for it,
on the platform we're running on. Once we've found the menu, we can use
its <span style="font-family: monospace;">append</span> or <span style="font-family: monospace;">extend</span> methods to add our commands to it.<br>
<br>The <span style="font-family: monospace;">basic_menus()</span> function returns a MenuList, so here's how we can add some commands to the Edit menu:<br>
<br>
<div style="margin-left: 40px;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">menus = basic_menus()</span><span style="font-family: monospace;"><br style="font-family: monospace;"></span>
<span style="font-family: monospace;">edit_menu =&nbsp;menus.menu_with_command('copy_cmd')</span><span style="font-family: monospace;"><br style="font-family: monospace;">
</span><span style="font-family: monospace;">edit_menu.extend(["-", ("Biggify", 'enlarge_cmd'), ("Smallify", 'reduce_cmd')])<br></span><span style="font-family: monospace;">app.menus =&nbsp;menus</span><br>
</div>
<h2>Future plans</h2>
One further thing you might want to do is insert commands in the
middle of a menu (to get them even closer to an existing command). This is
not currently supported, but is planned for a future version.<br>
<br>
---<br>
<br>
</body></html>

View File

@ -0,0 +1,117 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - Event Handling</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>Event Handling</h1>
<p>This section describes how the various types of events are handled, and
how the Application, Document, Window and View classes interact when handling
events.</p>
<p>Events can be classified into three groups:</p>
<ol>
<li>Mouse events</li>
<li>Keyboard events</li>
<li>Menu commands</li>
</ol>
<p>Although menu commands are not explicitly represented as Event objects,
they are handled in a similar way to events.</p>
<h2>Mouse events</h2>
<p>There are four kinds of mouse events, <i>mouse-down</i>, <i>mouse-drag</i>, <i>mouse-up&nbsp;</i>and <span style="font-style: italic;">mouse_move.</span>
</p>
<p>Mouse-down
and mouse-up events occur when a mouse button is pressed or released.
Mouse-drag events occur when the mouse is moved with a button held
down. Mouse-move events occur when the mouse is moved with no button down.<br>
</p>
<p>Mouse events are delivered simply by calling the
correspondingly-named method, if any, of the View object with which
they are associated. For example, mouse-down events are delivered by
calling the <tt>mouse_down</tt>
method of the view in which it occurs. If that view does not define a method with that name, the event is ignored.<br>
</p>
<p>Note that mouse-drag and mouse-up events are sent to the view in
which the preceding mouse-down event occurred, not the one currently
containing the mouse.<br>
</p>
<p>There is also an alternative way of receiving mouse-drag and mouse-up events, by entering a modal <i>mouse-tracking loop</i> in response
to a mouse-down event (see <a href="using_the_view_class.html#Mouse_tracking">Mouse Tracking</a>).</p><span style="font-style: italic;"></span><h2>Message delivery mechanism</h2>
<p>Keyboard events and menu commands are handled by a general mechanism called
the <i>message delivery mechanism. </i>A <i>message</i> consists of a message
name and optionally a tuple of arguments. The objects which can respond
to messages are subclasses of MessageHandler, and are arranged in a hierarchy
which corresponds partly to the Component containment hierarchy.</p>
<p>Message delivery proceeds in two phases, the <i>dispatching phase </i>and
the <i>handling phase</i>. <br>
</p>
<p>At any given moment, one of the application's windows is the <i>target
window</i> for keboard events and menu commands. Depending on the platform,
this may be the frontmost window, or the window containing the mouse pointer,
or it may be determined in some other way. Within the target window, one
of the components is designated as the <i>target object</i>, or just <i>target</i>.
The user typically makes a component the target by clicking on it or tabbing
into it. A component can also be made the target by calling its <tt>become_target</tt>
method.<br>
</p>
<p>If no component has been selected as the target within a window, the target
defaults to the window itself. If the application has no windows (possible
on some platforms), the Application is the target.<br>
</p>
<p>The dispatching phase consists of locating the target object and passing
the message to it. The handling phase is then entered by calling the <tt>handle</tt>
method of the target. If the target has a method called <tt>xxx</tt>, where
<i>xxx </i>is the name of the message, it is called with the message arguments.
Otherwise, the message is passed to the <tt>handle</tt> method of the object's
<i>next handler</i>. In the case of a Component, the next handler is the
component's container. </p>
<p>When the message reaches a Window object, it passes to the Document object
which owns the Window, and then to the Application object. If the Window
is not owned by a Document, the message is passed directly to the Application.</p>
<h2>Keyboard events</h2>
<p>Keyboard events may be classified into <i>key-down</i>, <i>key-up</i> and
<i>auto-key</i> events.<br>
</p>
<p>Key-down events are processed by dispatching a message named <tt>key</tt>_<tt>down</tt>,
with the event as its argument, to the current target. <br>
</p>
<p>Key-up events are not supported by all platforms. Where they are supported,
they are handled by dispatching a <tt>key_up</tt> message to the current
target.<br>
</p>
<p>An auto-key event is a key-down event generated by an auto-repeating key
rather than a physical keystroke, and is also handled by dispatching a <tt>key_down</tt> message. Not all platforms allow auto-key events to be distinguished from
key-down events; on platforms which do, they are distinguished by the <tt>auto</tt>
attribute of the event object being set to true.<br>
</p>
<h2>Menu commands</h2>
<p>The binding between a menu item and the action it invokes is through an
internal<i> command name</i> associated with the menu item. This allows
menu items to be rearranged and their text altered without affecting the
code of objects which handle the commands. Furthermore, the method to invoke
in response to a menu command is located by sending messages along the same
paths that keyboard events follow. This allows the same menu item to have
different effects depending on the context in which it is used.</p>
<p>There are two phases to handling menu commands, the <i>setup phase</i> and the <i>execution phase</i>. Each of these phases involves sending messages
up the message handler hierarchy.</p>
<p>The purpose of the setup phase is to set up the menus so that the appropriate
subset of the commands are enabled, and any check marks or other visual
indications are in an appropriate state.</p>
<p>Before pulling down the menu, all items in all menus of the current menubar
are first disabled (and any check marks, etc. are removed). Then the <tt>setup_menus</tt>
method of each object along the next-handler chain from the current target
is called. In response to this, each object enables those menu commands
which it knows about and are currently legal (and sets up any necessary
check marks, etc.)</p>
<p>Then the menu is pulled down and the user allowed to make a selection.
If a selection is made, a message is dispatched whose name is the command
name of the selected item. </p>
As well as a single menu item, a command name can also be associated
with a <i>group</i> of menu items whose contents can vary at run time. Examples
might be a list of font names in a Font menu, or a list of window titles
in a Windows menu. Within the group, individual items are distinguished by
an integer index. When an item from the list is invoked, its index is passed
as a parameter of the command message.<br>
<br>
<br>
<br>
</body></html>

Binary file not shown.

BIN
PyGUI-2.5.3/Doc/extent.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -0,0 +1,105 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - File Dialog Functions</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>module <span style="font-family: monospace;">FileDialogs</span></h1>
<p>This module defines functions that present dialog boxes for requesting new and existing files and directories according
to platform conventions.<br>
</p>
<h2>Parameters</h2>
<p>The following parameters are used by these functions:<br>
</p>
<dl style="margin-left: 40px;">
<dt style="font-family: monospace;">prompt</dt>
<dd>A prompt string to be displayed. It is up to the platform exactly
where and how the prompt is shown, and it may not be shown at all in
some cases. If omitted, a suitable default is used depending on the
type of request.<br>
<br>
</dd>
<dt style="font-family: monospace;">default_dir</dt>
<dd>A <a href="FileRef.html">FileRef</a> or <a href="DirRef.html">DirRef</a>
specifying the initial directory to be browsed. If omitted, a
platform-dependent default is used (usually the last directory visited
in the application by a file dialog).<br>
<br>
</dd>
<dt style="font-family: monospace;">default_name</dt>
<dd>For functions that request a new object name, the initial value
entered into the name area of the dialog. If omitted, the name area is
initially empty.<br>
<br>
</dd>
<dt><span style="font-family: monospace;">file_type, file_types</span></dt>
<dd>A <a href="FileType.html">FileType</a> or list of FileTypes specifying acceptable file types.</dd>
</dl>
<h2>Functions</h2>
<dl style="margin-left: 40px;">
<dt><tt><a name="request_old_file"></a>request_old_file(</tt><tt>prompt</tt> <tt>=</tt> <span style="font-family: monospace;">None</span><tt>,</tt> <tt>default_dir</tt> <tt>=</tt> <span style="font-family: monospace;">None</span><tt>,</tt> <tt>file_types</tt> <tt>=</tt> <tt>None<span style="font-family: monospace;">)</span><br>
<br>
</tt></dt>
<dd>Prompts the user to select an existing file. If any <span style="font-style: italic;">file_types</span> are supplied, the user is only allowed to select a file matching one of the specified types.</dd><dd><br>
</dd>
<dd>Returns a <a href="FileRef.html">FileRef</a>, or <tt>None</tt> if the user cancelled.</dd>
</dl>
<dl style="margin-left: 40px;">
</dl>
<dl style="margin-left: 40px;">
<dt><tt>request_old_files(</tt><tt>prompt</tt> <tt>=</tt> <span style="font-family: monospace;">None</span><tt>,</tt> <tt>default_dir</tt> <tt>=</tt> <span style="font-family: monospace;">None</span><tt>,</tt> <tt>file_types</tt> <tt>=</tt> <tt>None</tt><tt>)<br>
<br>
</tt></dt><dd>Prompts the user to select a set of existing files. If any <span style="font-style: italic;">file_types</span> are supplied, the user is only allowed to select files matching one of the specified types.</dd><dd><br>
</dd><dd>Returns a list of <a href="FileRef.html">FileRef</a>s, or <tt>None</tt> if the user cancelled.</dd>
</dl>
<dl style="margin-left: 40px;">
<dt><a name="request_new_file"></a><tt>request_new_file(</tt><tt>prompt</tt> <tt>=</tt> <span style="font-family: monospace;">None</span><tt>,</tt> <tt>default_dir</tt> <tt>=</tt> <span style="font-family: monospace;">None</span><tt>,</tt> <tt>default_name</tt> <tt>=</tt> <tt style="font-family: monospace;">None,</tt> <tt>file_type</tt> <tt>=</tt> <tt>None<span style="font-family: monospace;">)</span><br>
<br>
</tt></dt>
<dd>Prompts the user to supply a name and location for a new file. If <span style="font-style: italic;">file_type</span>
is specified, it should represent the type if file which is to be
created; some platforms use this to restrict the list of existing files
displayed, and to determine the suffix of the returned filename.<br>
</dd><dd><br>
</dd>
<dd>Returns a <a href="FileRef.html">FileRef</a>, or <tt>None</tt> if the user cancelled.</dd>
<dl>
</dl>
</dl>
<dl style="margin-left: 40px;">
<dt><tt>request_old_directory(</tt><tt>prompt</tt> <tt>=</tt> <span style="font-family: monospace;">None</span><tt>,</tt> <tt>default_dir</tt> <tt>=</tt> <span style="font-family: monospace;">None</span><tt>)</tt></dt><dd><br>
Prompts the user to select an existing directory.</dd><dd><br>
</dd><dd>Returns a <a href="FileRef.html">FileRef</a>, or <tt>None</tt> if the user cancelled.</dd>
</dl>
<dl style="margin-left: 40px;">
<dt></dt><dt><tt>request_old_directories(</tt><tt>prompt</tt> <tt>=</tt> <span style="font-family: monospace;">None</span><tt>,</tt> <tt>default_dir</tt> <tt>=</tt> <span style="font-family: monospace;">None</span><tt>)</tt></dt>
<dd><br>
Prompts the user to select a set of existing directories.</dd>
<dd><br>
</dd>
<dd>Returns a list of <a href="FileRef.html">FileRef</a>s, or <tt>None</tt> if the user cancelled.</dd>
</dl>
<dl style="margin-left: 40px;">
<dt><tt>request_new_directory(</tt><tt>prompt</tt> <tt>=</tt> <span style="font-family: monospace;">None</span><tt>,</tt> <tt>default_dir</tt> <tt>=</tt> <span style="font-family: monospace;">None</span><tt>,</tt> <tt>default_name</tt> <tt>=</tt> <span style="font-family: monospace;">None</span><tt><span style="font-family: monospace;">)</span><br>
<br>
</tt></dt>
<dd>Prompts the user to supply a name and location for a new directory.<br>
</dd><dd><br>
</dd><dd>Returns a <a href="FileRef.html">FileRef</a>, or <tt>None</tt> if the user cancelled.</dd>
</dl>
---<br>
</body></html>

156
PyGUI-2.5.3/Doc/index.html Normal file
View File

@ -0,0 +1,156 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI</title><meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"><!-- Changed by: Greg Ewing, 11-Aug-1998 -->
</head>
<body>
<h1 align="center">PyGUI</h1>
<h1 align="center"><small>A<br>
Graphical Application Framework<br>
for<br>
Python</small></h1>
<div align="center">by Greg Ewing<br>
</div>
<center>
<p><tt><a href="mailto:greg.ewing@canterbury.ac.nz">greg.ewing@canterbury.ac.nz</a></tt></p>
</center>
<p> </p>
<hr width="100%">
<h2>Discussion</h2>
<ul>
<li><a href="ownership.html">Overview</a></li>
<li><a href="terminology.html">Terminology</a></li>
<li><a href="event_handling.html">Event Handling</a></li><li><a href="coordinates.html">Coordinates, Points
and Rectangles</a><br>
</li>
<li><a href="actions.html">Actions</a></li>
<li><a href="menu_setup.html">Menu Setup</a></li>
<li><a href="using_the_view_class.html">Using the
View and ScrollableView classes</a></li>
<li><a href="customising-standard-menus.html">Customising
the Standard Menu Bar</a><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 153, 0);"></span></span></li>
<li><a href="Resources.html">Resources</a><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 102, 0);"></span></span></li>
<li><a href="navigation.html">Keyboard Navigation</a></li><li><a href="printing.html">Printing</a></li><li><a href="py2app_py2exe.html">Using PyGUI with Py2App and Py2Exe</a></li>
</ul>
<h2>Tutorials</h2><ul><li><a href="Tutorial.html">BlobEdit</a></li></ul><h2>Framework Classes</h2>
Classes making up the foundation of the model-view architecture and
message handling system.
<ul>
<li><a href="Application.html">class Application</a></li>
<li><a href="Document.html">class Document</a></li>
<li><a href="Window.html">class Window</a></li>
<li><a href="Model.html">class Model</a></li>
<li><a href="View.html">class View</a></li>
<li><a href="MessageHandler.html">class
MessageHandler</a></li>
</ul>
<h2>Abstract Classes</h2>
These
classes define properties and methods that other PyGUI classes have in
common. They are for internal use by the PyGUI framework only. You
should not instantiate these classes or derive your own classes
directly from them.<br>
<ul>
<li><a href="Component.html">class Component</a></li>
<li><a href="Container.html">class Container</a></li>
<li><a href="Control.html">class Control</a></li>
<li><a href="ViewBase.html">class ViewBase</a></li>
<li><a href="ImageBase.html">class ImageBase</a><br>
</li>
</ul>
<h2>Window Classes</h2>Components that appear as top-level windows on the desktop.
<ul>
<li><a href="Window.html">class Window</a></li>
<li><a href="Dialog.html">class Dialog</a></li>
<li><a href="ModalDialog.html">class ModalDialog</a><br>
</li></ul>
<h2>User-Defined View Classes</h2>Components with drawing and input-handling methods that you can override.<ul><li><a href="View.html">class View</a></li><li><a href="ScrollableView.html">class ScrollableView</a></li><li><a href="GridView.html">class GridView</a></li><li><a href="PaletteView.html">class PaletteView</a></li></ul><h2>Control Classes</h2>Components for displaying and editing values.
<ul>
<li><a href="Label.html">class Label</a></li>
<li><a href="Button.html">class Button</a></li><ul><li><a href="std_buttons.html#DefaultButton">class DefaultButton</a></li><li><a href="std_buttons.html#CancelButton">class CancelButton</a></li></ul>
<li><a href="CheckBox.html">class CheckBox</a></li>
<li><a href="RadioButton.html">class RadioButton</a></li>
<li><a href="TextField.html">class TextField</a></li>
<li><a href="Slider.html">class Slider</a><span style="color: rgb(255, 0, 0);"></span><br>
</li>
</ul>
<h2>Layout Classes</h2>Components for arranging other components.<br><ul><li><a href="Frame.html">class Frame</a></li><li><a href="Row.html">class Row</a></li><li><a href="Column.html">class Column</a></li><li><a href="Grid.html">class Grid</a></li></ul><h2>Text Editing Classes</h2>Components for displaying and editing text.<ul><li><a href="TextField.html">class TextField</a></li><li><a href="TextEditor.html">class TextEditor</a></li></ul><h2>Menu Classes</h2>
Classes for creating and manipulating menus and menu items.<br>
<ul>
<li><a href="Menu.html">class Menu</a></li>
<li><a href="MenuList.html">class MenuList</a></li>
<li><a href="MenuItem.html">class MenuItem</a><br>
</li>
</ul>
<h2>Graphics Classes</h2>
Classes concerned with drawing 2D graphics in user-defined views.<br>
<ul>
<li><a href="Canvas.html">class Canvas</a></li>
<li><a href="Color.html">class Color</a></li>
<li><a href="Font.html">class Font</a></li>
<li><a href="Image.html">class Image</a></li>
<li><a href="Pixmap.html">class Pixmap</a></li>
</ul>
<h2>Support Classes</h2>Non-graphical classes used behind the scenes.
<ul>
<li><a href="Event.html">class Event</a></li>
<li><a href="RadioGroup.html">class RadioGroup</a></li>
<li><a href="FileRef.html">class FileRef</a></li>
<li><a href="DirRef.html">class DirRef</a></li>
<li><a href="FileType.html">class FileType</a></li>
<li><a href="Task.html">class Task</a><span style="color: rgb(0, 102, 0);"></span></li>
<li><a href="Cursor.html">class Cursor</a><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 102, 0);"></span></span></li>
<li><a href="Exceptions.html">Exception classes</a><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0, 102, 0);"><br>
</span></span></li>
</ul>
<h2>OpenGL Classes</h2>Classes concerned with 3D drawing using OpenGL.
<ul>
<li><a href="GLConfig.html">class GLConfig</a><br>
</li>
<li><a href="GLView.html">class GLView</a></li>
<li><a href="GLPixmap.html">class GLPixmap</a><span style="color: rgb(0, 102, 0);"></span></li>
<li><a href="Texture.html">class Texture</a><span style="color: rgb(0, 102, 0);"></span></li>
<li><a href="DisplayList.html">class DisplayList</a><span style="color: rgb(0, 102, 0);"></span></li>
<li><a href="ShareGroup.html">class ShareGroup</a><span style="color: rgb(0, 102, 0);"></span></li>
</ul>
<h2>Printing Classes</h2>Classes related to printing support.<ul><li><a href="PageSetup.html">class PageSetup</a></li></ul><h2>Functions</h2>Stand-alone functions at the top level of the GUI package.
<ul>
<li><a href="Color.html">Color functions</a></li>
<li><a href="application_func.html#application">application()</a></li>
<li><a href="application_func.html#run">run()</a><span style="color: rgb(255, 0, 0);"></span><br>
</li>
</ul>
<h2>Submodules</h2>Functionality provided as submodules of the GUI package.
<ul>
<li><a href="StdColors.html">StdColors</a> - Predefined Color objects</li>
<li><a href="StdFonts.html">StdFonts</a> - Predefined Font objects</li>
<li><a href="StdCursors.html">StdCursors</a> - Predefined Cursor objects</li><li><a href="StdMenus.html">StdMenus</a> - Constructing standard Menus and MenuBars</li><li><a href="alert_funcs.html">Alerts</a> - Various kinds of alert boxes</li><li><a href="file_dialogs.html">FileDialogs</a> - Dialogs for requesting old and new file&nbsp;and directory names</li><li><a href="Resources.html">Resources</a> - Functions for finding and loading resources bundled with an application</li>
<li><a href="Geometry.html">Geometry</a> - Calculations with points and rectangles</li><li><a href="PageSetup.html">Printing</a> - Classes and functions related to printing</li>
<li><a href="GL.html">GL</a> - OpenGL facilities</li><li><a href="Numerical.html">Numerical</a> - NumPy interface</li><li><a href="PIL.html">PIL</a> - Python Imaging Library interface</li>
</ul>
<h2>Example Code</h2>
<ul>
<li><a href="../Demos/BlobEdit/blobedit.py">blobedit.py</a></li>
</ul>
<p> </p>
<hr width="100%">
<p></p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body></html>

View File

@ -0,0 +1,87 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>PyGUI - Menu Setup</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></head>
<body>
<h1>Menu Setup</h1>
During the setup phase of menu command handling, the <tt>setup_menus</tt>
method of each component along the message handling path is called with a
<i>menu state object</i>. The <tt>setup_menus</tt> method uses the menu state
object to enable or disable menu commands, add or remove check marks, and
establish the contents of menu item groups.<br>
<br>
Each setup phase begins with all menu items disabled and all check marks
removed, so it is normally only necessary to enable items and add check marks,
not disable or remove them. However, on occasion a component may want to
disable an item or remove a check mark that was enabled or added by a component
higher up in the message handling hierarchy. It can do this because the <tt>setup_menus</tt>
methods are called from the top of the message handling hierarchy to the
bottom, giving more specific handlers the chance to override menu setup decisions
made by more general ones.<br>
<h2>Menu state objects</h2>
A menu state object consists of a collection of <i>command state</i> and
<i>command group</i> objects representing all the menu commands present in
all the currently available menus, organised by their <i>command names</i>.
An item can be selected from the menu state object by using the command name
as either an attribute name or an index. For example, given a menu state
object <tt>m</tt>, the state object for the command '<tt>foo_cmd</tt>' can
be referred to as either<br>
<blockquote><tt>m.foo_cmd</tt><br>
</blockquote>
or<br>
<blockquote><tt>m['foo_cmd']</tt><br>
</blockquote>
Note that it is not an error to reference a non-existent command. Referring
to a command that is not currently present in the available menus returns
a dummy command state object, manipulation of which has no effect.<br>
<h2>Command state objects</h2>
A command state object represents the state of a single menu item.<br>
<h3>Properties</h3>
<blockquote>
<dl>
<dt><tt>enabled</tt></dt>
<dd>True if the item is to be selectable by the user.</dd>
<dd><br>
</dd>
<dt><tt>checked</tt></dt>
<dd>True if there is to be a distinguishing mark displayed beside the
menu item. The precise appearance of this is platform-dependent.</dd>
</dl>
</blockquote>
<h2>Command group objects</h2>
A command group object is a sequence object representing an indexed group
of menu items. It allows the contents of the group to be established, and
provides access to the command state objects of the individual items. It
also allows the enabled and checked status of all the items to be changed
at once.<br>
<h3>Properties</h3>
<blockquote>
<dl>
<dt><tt>enabled</tt></dt>
<dt><tt>checked</tt></dt>
<dd><i>Write-only.</i> Assigning to these properties changes the corresponding
properties of all the items in the group.</dd>
</dl>
</blockquote>
<h3>Operators</h3>
<blockquote>
<dl>
<dt><i>group</i>[<i>index</i>]</dt>
<dd><i>Read-only.</i> Returns a command state object for the item with
the specified index.</dd>
</dl>
</blockquote>
<h3>Methods</h3>
<blockquote>
<dl>
<dt><tt>set_items(</tt><i>item_list</i><tt>)</tt></dt>
<dd>Replaces the contents of the group with a set of menu items constructed
from the <i>item_list</i>. Each member of the <i>item_list</i> should be
a "text/key" string as accepted by the <a href="Menu.html">Menu</a> class
constructor.</dd>
</dl>
</blockquote>
<br>
<br>
</body></html>

View File

@ -0,0 +1,12 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>PyGUI - Keyboard Navigation</title></head><body><h1>Keyboard Navigation</h1>Most
platforms allow you to use the Tab key to move from one text field to
another within a window. Some (e.g. Gtk, Windows) also allow you to tab
into non-text controls such as buttons and check boxes. Some (e.g.
MacOSX) do not do this by default, but provide a user preference
setting for enabling it.<br><br>By default, PyGUI follows the platform conventions concerning the behaviour of the Tab key, but allows the user to change it.<br><br>On Gtk and Windows, setting the <span style="font-family: monospace;">PYGUI_KEYBOARD_NAVIGATION</span>
environment variable to a true value ("True" or "1") enables tabbing
into all controls, and setting it to a false value ("False" or "0")
disables this.<br><br>On MacOSX, this environment variable is not used,
and the System Preferences settings under Keyboard Shortcuts for tab
key behaviour are always followed.</body></html>

Binary file not shown.

View File

@ -0,0 +1,66 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - Overview</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<p><!-- Changed by: Greg Ewing, 11-Dec-1997 --></p>
<h1>Overview of the PyGUI Framework</h1>
<p>This section briefly describes the main classes making up the PyGUI application
framework and how they interact.</p>
<h2>Application class</h2>
<p>There is exactly one Application object which looks after everything that
is global to the application. If your application is very simple, you may
not even need to know about the Application class - an instance of it will
be created automatically when needed. If you want to make use of the Document-View
architecture, however, you will probably want to define a subclass of Application
and add your own code to it.</p>
<h2>Document class</h2>
<p>A&nbsp;Document object represents an application data structure which
can be stored in a file. A&nbsp;Document is also a Model so that it can have
Views attached to it (see below). If the data structure is simple, it could
be contained entirely in the Document object. A more complex data structure
might be composed of many objects, with a Document object at the head. Some
or all of these sub-objects may be Models so that Views can be attached to
parts of the data structure.</p>
<h2>Window and Component classes</h2>
<p>A&nbsp;Window represents a top-level window on the screen. Windows serve
as containers for Components, which are all the usual user interface widgets
such as buttons, scroll bars, text fields, etc. Some kinds of Components
are also Containers. A Container can contain other Components and clip them to its
boundary. Window and View, for example, are subclasses of Container.</p>
<h2>View and Model classes</h2>
<p>A&nbsp;View is a general-purpose Component for displaying graphics and
handling input events. A View can be associated with a Model representing
the data structure that it is to display. There can be many Views attached
to each Model, and when the Model is changed, all of its Views are notified
so that they can update themselves.</p>
<h2>Ownership hierarchy</h2>
<p>There are ownership relationships between Application, Document, Window
and Component objects. The Application is at the top of the hierarchy, and
owns all of the&nbsp;Documents. Each Document can own some number of Windows,
each Window owns all of its contained Components, those Components which are Containers own all their contained Components, and so forth. There can also be
Windows that do not belong to a&nbsp;Document and are owned directly by the
Application.</p>
<p>The ownership hierarchy serves two purposes. It defines a path for handling
events (see <a href="event_handling.html">Event&nbsp;Handling</a>), and
it allows a Document to be closed when all the Windows belonging to it have
been closed.</p>
<p>Figure 1 below illustrates the ownership relationships, and Figure 2 shows
some examples of how View-Model relationships might be set up.</p>
<p> </p>
<hr width="100%"> <p></p>
<p align="center"><img src="ownership.jpg" alt="" height="648" width="576">
</p>
<center> <p><b>Figure 1</b> </p>
<hr width="100%"> <p></p>
</center>
<center> <p><img src="view-model.jpg" alt="" height="648" width="576">
</p>
</center>
<center> <p><b>Figure 2</b> </p>
<hr width="100%"> <p></p>
</center>
<br>
<br>
</body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

166
PyGUI-2.5.3/Doc/place.html Normal file
View File

@ -0,0 +1,166 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>PyGUI - Placement Methods</title>
<meta name="GENERATOR" content="Mozilla/3.01Gold (X11; I; SunOS 5.6 sun4u) [Netscape]"></head>
<body>
<h1>Placement Methods</h1>
<p>Class Frame provides three methods, <tt>place</tt>, <tt>place_row</tt>
and <tt>place_column</tt>, for adding and laying out subcomponents. These
methods accept a very flexible set of options for specifying the position
and size of the subcomponents, adding scroll bars and borders to them,
and controlling how they behave when the containing frame is resized.<br>
</p>
<h2>Common placement options</h2>
The following options are accepted by all three placement methods.<br>
<h3>Positioning options<br>
</h3>
<blockquote> <dl>
<dt><tt>left</tt></dt>
<dt><tt>right</tt></dt>
<dt><tt>top</tt></dt>
<dt><tt>bottom</tt></dt>
<dd>These options specify the initial positions of the edges of a component.
They may take one of four forms:
<br>
<ol>
<li><tt>None</tt></li>
<p>This is the default value, and it leaves the edge unspecified.
The position of an unspecified edge is determined by the component's current
size and the positioning of the opposite edge. If the opposite edge is
unspecified as well, the positions of both edges are left as they are.</p>
<li>A <i>distance</i></li>
<p>The edge is positioned at the specified distance from one of the
edges of the containing frame. Which edge of the frame is used depends
on the value of <i>distance</i>. Positive distances are measured from
the left or top edge of the frame, whereas negative distances are measured
from the right or bottom edge of the frame.<br>
</p>
<p>A distance of zero is measured from the corresponding edge to the
one being specified -- for example, specifying <tt>left</tt> <tt>=</tt> <tt>0</tt> positions the left edge of the component at the left edge
of the frame, and specifying <tt>right</tt> <tt>=</tt> <tt>0</tt> positions
the right edge of the component at the right edge of the frame.</p>
<li>A <i>component</i></li>
<p>The edge is aligned with the <i>opposite</i> edge of the specified
component. For example, specifying <tt>left</tt> <tt>=</tt> <tt>my_button</tt> aligns the left edge of the component with the right edge of <tt>my_button</tt>.</p>
<li>An expression of the form <i>component</i> <tt>+</tt> <i>distance
</i>or<i>&nbsp;</i><i>component</i> <tt>-</tt> <i>distance</i></li>
<p>The edge is positioned at the specified distance from the <i>opposite</i>
edge of the specified component. For example, specifying <tt>left</tt> <tt>=</tt> <tt>my_button</tt> <tt>+</tt> <tt>10</tt> positions the
left edge of the component 10 pixels to the right of the right edge of
<tt>my_button</tt>, and specifying <tt>bottom</tt> <tt>=</tt> <tt>my_label</tt> <tt>-</tt> <tt>20</tt> positions the bottom edge of the component
20 pixels above the top edge of <tt>my_label</tt>.</p>
</ol>
It is important to understand that these options only control
the <i>initial</i> position and size of the component. Specifying
and edge relative to another component does not create any sort of connection
or constraint between the two components. Whether the relationship will
be maintained when the frame is subsequently resized depends entirely on
the value of the <tt>sticky</tt> option (see below).<br></dd>
<dd>Note also that the <tt>left</tt>, <tt>top</tt>, <tt>right</tt>, and
<tt>bottom</tt> <i>options</i> to the placement methods are quite different
from the <tt>left</tt>, <tt>top</tt>, <tt>right</tt>, and <tt>bottom</tt> <i>properties</i> of components. The special forms described above
can be used only with the former and not with the latter.<br>
</dd>
</dl>
</blockquote>
<h3>Resizing options</h3>
<blockquote> <dl>
<dt><tt>sticky</tt></dt>
<dd>This option controls what happens to the position and size of the
component when the frame is subsequently resized. It consists of a string
made up of the letters '<tt>n</tt>', '<tt>s</tt>', '<tt>e</tt>' and '<tt>w</tt>'
for north, south, east and west.</dd>
<dd><br>
</dd>
<dd>If <tt>sticky</tt> contains '<tt>w</tt>' but not '<tt>e</tt>', the
component will "stick" to the left edge of the frame, meaning that its position
and size in the horizontal direction will not change when the frame is resized.
If it contains '<tt>e</tt>' but not '<tt>w</tt>', the component will stick
to the right edge of the frame, meaning that it will move along with the
right edge of the frame while retaining its size.</dd>
<dd><br>
</dd>
<dd>If <tt>sticky</tt> contains both '<tt>e</tt>' and '<tt>w</tt>', the
component's left edge will stick to the left edge of the frame, and its right
edge will stick to the right edge of the frame. The component will therefore
stretch or shrink in the horizontal direction when the frame changes size.</dd>
<dd><br>
</dd>
<dd>Similar considerations apply to the letters '<tt>n</tt>' and '<tt>s</tt>'
with regard to the vertical direction.</dd>
<dd><br>
</dd>
<dd>The default value of <tt>sticky</tt> is '<tt>nw</tt>', so that the
component sticks to the top and left edges of the frame.</dd>
</dl>
</blockquote>
<h3>Scrolling options</h3>
<blockquote>
<dl>
<dt><tt>scrolling</tt></dt>
<dd>This option is a string made up of the letters '<tt>h</tt>' and '<tt>v</tt>'
specifying horizontal and vertical scrolling, respectively. It should only
be used when the component being placed is a subclass of ScrollableView, or some other
component that supports scrolling. The effect of using it on a component
that does not support scrolling is undefined.</dd>
</dl>
</blockquote>
<h3>Border options</h3>
<blockquote>
<dl>
<dt><tt>border</tt></dt>
<dd>This is a boolean option requesting that the component be given a
border. Whether a border is actually added, and if so, its size and appearance,
depends on the platform and on the type of component being placed. When a
border is provided, it exists outside the bounds of the component, and is
not included in the calculation of any component's position and size.<br>
</dd>
</dl>
</blockquote>
<h2>Placing rows and columns</h2>
<dl>
<dt>Whereas the <tt>place</tt> method places a single component at a time,
the <tt>place_row</tt> and <tt>place_column</tt> methods can be used to lay
out a list of components in a row or column. These two methods accept all
of the placement options listed above, plus the following:</dt>
</dl>
<blockquote>
<dl>
<dt><tt>spacing</tt></dt>
<dd>The amount of space to leave between adjacent components. If unspecified,
a platform-dependent default is used.</dd>
</dl>
</blockquote>
Placing a row or column is achieved by first placing one of the components
as specified by the given options, and then placing each subsequent component
relative to the previous one. All of the same placement options are applied
to each subsequent component, except for one of its edges, which will be
positioned at the specified <tt>spacing</tt> from the previous component.<br>
<br>
Which component is placed first, and the direction of subsequent component
placement, is determined by which edges are specified in the placement options.
For example, if you specify the <tt>left</tt> edge when placing a row, the
first component in the list will be placed first, with its left edge at the
specified position. The second component will then be placed to the right
of the first, with the left edge of the second component relative to the
right edge of the first, and so forth.<br>
<br>
On the other hand, if you specify the <tt>right</tt> edge (instead of the left
edge), then the <i>last</i> component in the list will be placed first, and
then the second-to-last to the left of it, and so forth.<br>
<br>
(It is currently illegal to specify both the left and right edges when placing
a row, or both the top and bottom edges when placing a column. This restriction
may be lifted in the future.)<br>
<br>
If you're finding the above description too confusing, just think of the
edge specifications as applying to the whole collection of components rather
than to any individual component. For example, <tt>my_frame.place_row([button1,</tt>
<tt>button2,</tt> <tt>button3],</tt> <tt>top</tt> <tt>=</tt> <tt>42,</tt>
<tt>right</tt> <tt>=</tt> <tt>-12,</tt> <tt>spacing</tt> <tt>=</tt> <tt>8)</tt>
means "place these buttons in a row 8 pixels apart, 42 pixels from the top
of the frame and 12 pixels from the right."
<h2> ---<br>
</h2>
</body></html>

View File

@ -0,0 +1,77 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>Printing</title></head>
<body><h1>Printing</h1>Most
of the time you won't have to do anything to get basic printing support
in your PyGUI application. There are default implementations of the <span style="font-style: italic;">Page Setup</span> command in the Application class, and the <span style="font-style: italic;">Print</span>
command in the View and ScrollableView classes. The generic printing
system uses the same code for printing a view as is used for drawing to
the screen, so once you've written a <span style="font-family: monospace;">draw()</span> method for your view, you can also print it.<br><br>While
the default printing system works well enough, it is fairly rudimentary
and won't always do exactly what you want. However,&nbsp;you can
customise and build upon it in various ways to provide more advanced
features. This section explains how the printing support in PyGUI works
and how you can extend it.<br><h2>Page Setup</h2>Page setup information is represented by an instance of the <a href="PageSetup.html">PageSetup</a>
class. This class holds all of the information typically specified by a
"Page Setup" dialog. For PyGUI's purposes, the most important of these
are the<span style="font-style: italic;"> </span><span style="font-weight: bold;">paper size</span> (the physical size of the sheet of paper) and the <span style="font-weight: bold;">margins</span> (the distances from the edge of the paper to the region that will be printed on). Together these determine the <span style="font-weight: bold;">page size</span> (the size of the printed area). The following diagram illustrates the relationships between these attributes.<br><br><div style="text-align: center;"><img style="width: 231px; height: 300px;" alt="" src="page_setup.png"><br></div><br>The Application object has a <span style="font-family: monospace;">page_setup</span> attribute that holds a default PageSetup instance, and an implementation of the <span style="font-style: italic;">Page Setup</span> command that presents a dialog for editing it. The Document class also has a <span style="font-family: monospace;">page_setup</span> attribute and a corresponding <span style="font-style: italic;">Page Setup</span>
command handler. Thus, in a document-oriented application, each
document has its own set of page setup information. If a view is
associated with a document, it will use that document's PageSetup when
printed; otherwise, it will use the application-wide one.<br><br>None
of these PageSetup objects are automatically saved anywhere. If you
want them to persist, you will need to save them along with your
document data, or if you're not using documents, write the
application-wide one to a preferences file. To facilitate this,
PageSetup objects are designed to be pickled. They also have <span style="font-family: monospace;">to_string()</span> and <span style="font-family: monospace;">from_string()</span> methods, in case you don't want to use pickle.<br><br>You can customise the way page setup information is edited by overriding the <span style="font-family: monospace;">page_setup_cmd()</span> method of a view, a document or the application. You may want to make use of the utility function <a href="PageSetup.html#present_page_setup_dialog">present_page_setup_dialog()</a>, which displays the platform's standard page setup dialog for a given PageSetup instance.<br><h2>Printing Views</h2>The <span style="font-style: italic;">Print</span> command is handled by the <span style="font-family: monospace;">print_cmd()</span> method of the View and ScrollableView classes. First, the view attempts to find a PageSetup instance. If the view's <span style="font-family: monospace;">model</span> attribute refers to a Document, and the document's <span style="font-family: monospace;">page_setup</span>
attribute is not None, then it is used. Otherwise, the application-wide
PageSetup is used. If you want the PageSetup to be located some other
way, you can override the <span style="font-family: monospace;">get_page_setup()</span> method of the view.<br><br>Next, the view's <span style="font-family: monospace;">print_view()</span>
method is called, with the PageSetup object as a parameter. This method
does most of the hard work. First it determines the total size of the
area to be printed. For a View, this is the same as the size of the
view on the screen; for a ScrollableView, it is the view's extent.<br><br>Then the printed area is divided into pages. with the size of each page equal to the <span style="font-family: monospace;">page_size</span> attribute of the PageSetup. The view's <span style="font-family: monospace;">draw()</span>
method is called once for each page, with a special canvas object that
draws to the printer instead of the screen. In place of the update_rect
parameter, a rectangle is passed representing the bounds of the page
currently being drawn.<br><br>The following diagram illustrates a view
with a large extent being divided into pages for printing. Note that
the origin of the coordinate system as seen by the <span style="font-family: monospace;">draw()</span> method is
always at the top left corner of the extent, regardless of which page
is being printed. So the view doesn't need to know whether it's drawing
to a screen or a printer (although it can find out if it wants to, as
we will see below).<br><br><div style="text-align: center;"><img style="width: 406px; height: 360px;" alt="" src="pagination.png"><br></div><h2>Customising Printing</h2>Often
you won't want to print a view exactly the same way as it appears on
the screen. For example, things like selection highlighting and page
boundaries should only be shown on the screen and not on the printed
page. The Canvas object passed to the <span style="font-family: monospace;">draw()</span> method has a <span style="font-family: monospace;">printing</span>
attribute that is true when printing and false when drawing to the
screen. You can use this to determine which elements of the view should
be drawn.<br><br>This technique is sufficient to accommodate minor
differences between screen drawing and printing. Sometimes, however,
you may want to lay out the document quite differently when printing.
An example would be a word processor where you want to display the text
in a continuous "galley" view on the screen, without any page breaks.
When printed, however, you want to add headers and footers to each
page. This presents a problem, because the extent of the view has to be
increased when printing in order to accommodate the headers and footers.<br><br>The
solution to this kind of problem is to use a different view subclass
for printing. When you come to print, instead of printing the view that
you use on the screen, create an off-screen instance of the printing
view and call its <span style="font-family: monospace;">print_view()</span>
method. The printing view can then calculate its extent appropriately
and generally do things in as different a way as needed from the
on-screen one.<br><br>An example of the use of this technique can be
seen in PyGUI's TextEditor class. When printed, it wraps to the width
of the page instead of the width of the view on the screen. It also
figures out how many lines will fit on a page and avoids splitting a
line between two pages. To accomplish this, it uses a separate View
subclass behind the scenes (TextEditorPrintingView). It's implemented
in pure Python, so you can examine it if you want to see how it works.<br><br>There
are a couple of ways you can intervene in order to introduce your
custom printing view into the printing process. One way is to override
the <span style="font-family: monospace;">print_view()</span> method of the on-screen view to instantiate a printing view and then call its <span style="font-family: monospace;">print_view()</span> method instead. (This is the technique used by TextEditor.)<br><br>The
other way, applicable in a document-oriented application, is to handle
printing at the document level instead of the view level. This may make
more sense if you have a number of different kinds of on-screen view of
the document, but only one way of printing it. Whichever view is active
when the user gives the <span style="font-style: italic;">Print</span> command, you want the same printing code to be invoked.<br><br>To do it this way, you will first need to disable handling of the <span style="font-style: italic;">Print</span> command in the view, otherwise it will never get as far as the document. You can do this by setting the <span style="font-family: monospace;">printable</span> property of the view to false. The view will then ignore the <span style="font-style: italic;">Print</span> command and pass it on to the next handler.<br><br>Then you can give your Document subclass a <span style="font-family: monospace;">print_cmd() m</span>ethod that creates an instance of your printing view and calls its <span style="font-family: monospace;">print_view()</span> method, passing it the document's <span style="font-family: monospace;">page_setup</span>. Remember to enable the <span style="font-style: italic;">Print</span> command in the document's <span style="font-family: monospace;">setup_menus()</span> method.<br><br>---</body></html>

Binary file not shown.

View File

@ -0,0 +1,10 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>Py2Exe and PyGUI</title></head><body><h1>Using PyGUI with Py2App and Py2Exe</h1>As
of PyGUI version 2.5, it is no longer necessary to explicitly tell
Py2App or Py2Exe to include the GUI package. Just import the things
that you use, and Py2App and Py2Exe will find them in the usual way.<br><br>However,
Py2Exe does need a small amount of help to find certain modules in
pywin32. A helper module is included in the GUI package to make the
necessary adjustments; all you have to do is import it into your
setup.py script along with py2exe. The imports at the top of your
setup.py script should include the following:<br><br><tt>from distutils.core import setup<br>import GUI.py2exe<br>import py2exe<br></tt><br></body></html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>module StdButtons</title></head><body><h1>module <span style="font-family: monospace;">StdButtons</span></h1>This module defines some standard <a href="Button.html">Button</a> subclasses.<br><h2>Constructors</h2><dl style="margin-left: 40px;"><dt style="font-family: monospace;"><a name="DefaultButton"></a>DefaultButton(title = "OK",
style = 'default', action = 'default_action')</dt><dt style="font-family: monospace;"><a name="CancelButton"></a>CancelButton(title = "Cancel",
style = 'cancel', action = 'cancel_action')</dt><dd><br>
These create buttons with the appropriate appearance and behaviour for
use as OK or Cancel buttons in a dialog box. By default, when used in a
modal dialog, the DefaultButton will dismiss the dialog with the value
True, and the CancelButton will dismiss it with the value False. These
actions can also be invoked with the Return/Enter and Escape keys. See <a href="file:///Local/Projects/D/PyGUI/Source/Doc/Dialog.html">Dialog</a> and <a href="file:///Local/Projects/D/PyGUI/Source/Doc/ModalDialog.html">ModalDialog</a> for more
information.</dd></dl>
<h2></h2></body></html>

Some files were not shown because too many files have changed in this diff Show More