Re-sizable preview window & --viewer_size CLI argument #175
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
as suggested by #172, I added a way to resize the viewer
You can either resize the window like normal and it will snap to the proper aspect ratio OR you can use the
--viewer_size
argument to change the viewer size by a multiple.Uses:
--viewer_size <positive float>
hypergan ... --viewer_size 2
will double the size of the windowhypergan ... --viewer_size 0.5
will half the size of the windowhypergan ... --viewer_size 0.01
will make the window 1/100th the sizehypergan ... --viewer_size 0
will default to 0.1hypergan ... --viewer_size -5
will default to 0.1Notes:
I wanted it so when you try to resize the window it locks you to the proper aspect ratio but pygame doesn't support
display.set.mode()
while resizing (or any form of aspect ratio locking for that matter). So this is the next best thing. You resize the window and it snaps to the right aspect ratio after letting go.Using high values for
--viewer_size
may cause an immediate crash when the viewer tries to open. I think its an issue with pygame. It happens to me when I set the size above 60. I added a warning about this in the help section. I decided against adding a hard cap because its most likely dependent on the GPU/CPU configurations in the system. And they will figure out right away if it doesn't work (ie: they wont loose training progress b/c of it crashing)When dragging the window from one monitor to the other the window will sometimes resize. This may just be an issue with my window manager (xfwm). When moving from one monitor to the other a
VIDEORESIZE
event is emitted that is identical to the one emitted when the user actually resizes. If any of you are willing to test this with other OS's and window managers that would be greatly appreciated. Just addprint(event)
after line 39 of /hypergan/pygame_viewer.py and send the output my way. Its a very minimal issue though.I have a commented version on this gist
Thanks for making learning about GAN's so easy! :)
-qwazwsx