Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
Fixed documentation to change explanation of calling handleEvent from "main loop" or "big loop" to "event loop"
  • Loading branch information
IrvKalb committed Oct 26, 2021
1 parent d522ecb commit 006255e
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions pygwidgets/pygwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def __init__(self, window, loc, surfaceUp, surfaceOver, surfaceDown, surfaceDisa
self.state = PygWidgetsButton.STATE_IDLE # starting state

def handleEvent(self, eventObj):
"""This method should be called every time through the main loop.
"""This method should be called every time through the event loop (inside the main loop).
It handles showing the up, over, and down images of the button.
Expand Down Expand Up @@ -681,7 +681,7 @@ class TextButton(PygWidgetsButton):
There are many optional parameters, including width and height that have good defaults.
2) In your big loop, check for the button being clicked by calling its handleEvent method:
2) In your event loop, check for the button being clicked by calling its handleEvent method:
if myButton.handleEvent(event): # When the button is clicked, this returns True
# the button was clicked, do whatever you want here
Expand Down Expand Up @@ -828,7 +828,7 @@ class CustomButton(PygWidgetsButton):
| over='images/ButtonOver.png',
| disabled='images/ButtonDisabled.png')
2) In your big loop, check for the button being clicked by calling its handleEvent method:
2) In your event loop, check for the button being clicked by calling its handleEvent method:
if myButton.handleEvent(event): # When the button is clicked, this returns True
# the button was clicked, do whatever you want here
Expand Down Expand Up @@ -950,7 +950,7 @@ def __init__(self, window, loc, theRect,


def handleEvent(self, eventObj):
"""This method should be called every time through the main loop.
"""This method should be called every time through the event loop (inside the main loop).
It handles showing the up, over, and down states of the button.
Expand Down Expand Up @@ -1071,7 +1071,7 @@ class TextCheckBox(PygWidgetsCheckBox):
There are many optional parameters, that have good defaults.
2) In your big loop, check for the button being clicked by calling its handleEvent method:
2) In your event loop, check for the button being clicked by calling its handleEvent method:
if myCheckBox.handleEvent(event): # When clicked on to toggle, this returns True
# CheckBox was clicked, do whatever you want here
Expand Down Expand Up @@ -1222,7 +1222,7 @@ class CustomCheckBox(PygWidgetsCheckBox):
off='images/CheckBoxDown.png',
value=True)
2) In your big loop, check for the button being clicked by calling its handleEvent method:
2) In your event loop, check for the button being clicked by calling its handleEvent method:
if myCheckBox.handleEvent(event): # When clicked on to toggle, this returns True
# CheckBox was clicked, do whatever you want here
Expand Down Expand Up @@ -1358,7 +1358,7 @@ def __init__(self, window, loc, group, buttonRect,


def handleEvent(self, eventObj):
"""This method should be called every time through the main loop.
"""This method should be called every time through the event loop (inside the main loop).
It handles showing the up, over, and down states of the button.
Expand Down Expand Up @@ -1528,7 +1528,7 @@ class TextRadioButton(PygWidgetsRadioButton):
There are many optional parameters, that have good defaults.
2) In your big loop, check for the radioButton being clicked by calling its handleEvent method:
2) In your event loop, check for the radioButton being clicked by calling its handleEvent method:
if myRadioButton.handleEvent(event): # When clicked on to select, this returns True
# RadioButton was clicked, do whatever you want here
Expand Down Expand Up @@ -1649,7 +1649,7 @@ class CustomRadioButton(PygWidgetsRadioButton):
'images/CheckBoxOn.png',
'images/CheckBoxDown.png')
2) In your big loop, check for the radioButton being clicked by calling its handleEvent method:
2) In your event loop, check for the radioButton being clicked by calling its handleEvent method:
if myRadioButton.handleEvent(event): # When clicked on to select, this returns True
# RadioButton was clicked, do whatever you want here
Expand Down Expand Up @@ -1916,7 +1916,7 @@ class InputText(PygWidget):
myInputText = pygwidgets.InputText(myWindow, (100, 200)) # Other optional arguments ...
2) In your big while loop, call the 'handleEvent' method of the InputText object(s)
2) In your event loop, call the 'handleEvent' method of the InputText object(s)
It will return False most of the time, and will return True when the user presses RETURN or ENTER
Here is the typical code to use:
Expand Down Expand Up @@ -2025,8 +2025,7 @@ def _updateImage(self):


def handleEvent(self, event):
"""This method should be called every time through the main loop.
"""This method should be called every time through the event loop (inside the main loop).
It handles all of the keyboard key actions
Parameters:
Expand Down Expand Up @@ -2243,7 +2242,7 @@ class Dragger(PygWidget):
myDragger= pygwidgets.Dragger(myWindow, (100, 200), 'images/DragMe.png') # Other optional arguments ...
2) In your big while loop, call the 'handleEvent' method of the Dragger object(s)
2) In your event loop, call the 'handleEvent' method of the Dragger object(s)
It will return False most of the time, and will return True when the user presses and lifts up on the mouse
Here is the typical code to use:
Expand Down Expand Up @@ -2307,7 +2306,7 @@ def __init__(self, window, loc, up, down=None, over=None, disabled=None, nicknam


def handleEvent(self, eventObj):
"""This method should be called every time through the main loop.
"""This method should be called every time through the event loop (inside the main loop).
It handles all of the dragging
Expand Down Expand Up @@ -2485,7 +2484,7 @@ def replace(self, newPathOrImage):
self.rotate(self.angle)

def handleEvent(self, event):
"""If you want to check for a click, this method should be called every time through the main loop.
"""If you want to check for a click, this method should be called every time through the event loop.
It checks to see if the user has done a mouse down on the image.
Expand Down Expand Up @@ -2784,7 +2783,7 @@ def __init__(self, window, loc, loop, showFirstImageAtEnd, nickname, callBack, n
self.state = PYGWIDGETS_ANIMATION_STOPPED

def handleEvent(self, eventObj):
"""This method should be called every time through the main loop.
"""This method should be called every time through the event loop (inside the main loop).
Returns:
False - if no event happens.
Expand Down Expand Up @@ -2981,7 +2980,7 @@ class Animation(PygAnimation):
See below for details and optional parameters.
2) If you want to allow clicking on the animation to start the animation playing,
then you need to call the handleEvent method every time through the loop.
then you need to call the handleEvent method every time through the event loop.
Most of the time it will return False, but will return True when the animation is clicked on.
if myAnimation.handleEvent(event):
Expand Down Expand Up @@ -3083,7 +3082,7 @@ class SpriteSheetAnimation(PygAnimation):
See below for details and optional parameters.
2) If you want to allow clicking on the animation to start the animation playing,
then you need to call the handleEvent method every time through the loop.
then you need to call the handleEvent method every time through the event loop.
Most of the time it will return False, but will return True when the animation is clicked on
if myAnimation.handleEvent(event):
Expand Down

0 comments on commit 006255e

Please sign in to comment.