Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pygame.transform.threashold tests, keyword arguments, docs. #408

Merged
merged 24 commits into from Mar 12, 2018

Conversation

Projects
None yet
1 participant
@illume
Copy link
Member

illume commented Mar 1, 2018

"Threshold does not take keyword arguments"
https://www.reddit.com/r/pygame/comments/80zyqg/threshold_does_not_take_keyword_arguments/

Identifies a couple of problems:

  • no test for inverse argument.
  • argument names are super confusing and the documentation could be better.
  • no test for keyword arguments.
  • keyword arguments aren't supported.
  • Using the 'inverse' argument with the last surface argument set to None is not possible.
  • lots of invalid argument combinations were possible.
  • unit tests made more readable (using kwargs).
  • new documentation.
@illume

This comment has been minimized.

Copy link
Member Author

illume commented Mar 1, 2018

Was thinking of constants for this...

pygame.transform.THRESHOLD_USE_SET_COLOR == 1
pygame.transform.THRESHOLD_JUST_COUNT == 0
pygame.transform.THRESHOLD_USE_SURFACE == 2

+        # set_behavior = 1           # 1 - pixels in dest_surface will be changed to 'set_color'.
+        #                            # 0 - we do not change 'dest_surf', just count. Make dest_surf=None.
+        #                            # 2 - pixels set in 'dest_surf' will be from 'surface'. 

But then I thought just using keyword arguments would be cleaner.

use_set_color = True
just_count = True
use_surface_colors = True

Unfortunately we have to keep backwards compatibility. So, no extra keyword arguments.

@illume illume force-pushed the thresholding branch from 35cc9c7 to 2e27e29 Mar 6, 2018

illume added some commits Mar 1, 2018

Make search_surf optional. Fix test. Implementation is wrong.
It is setting the color from search_color, not set_color.

@illume illume changed the title WIP pygame.transform.threashold tests and keyword arguments. pygame.transform.threashold tests, keyword arguments, docs. Mar 6, 2018

@illume illume merged commit e20de1a into master Mar 12, 2018

4 checks passed

continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@illume illume deleted the thresholding branch Mar 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.