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

Re-sizable preview window & --viewer_size CLI argument #175

Closed
wants to merge 3 commits into from
Closed

Re-sizable preview window & --viewer_size CLI argument #175

wants to merge 3 commits into from

Conversation

qwazwsx
Copy link

@qwazwsx qwazwsx commented Jul 14, 2018

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 window
hypergan ... --viewer_size 0.5 will half the size of the window
hypergan ... --viewer_size 0.01 will make the window 1/100th the size
hypergan ... --viewer_size 0 will default to 0.1
hypergan ... --viewer_size -5 will default to 0.1

Notes:

  • 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 add print(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

@mikkel mikkel changed the base branch from master to develop December 18, 2018 01:26
@mikkel
Copy link
Contributor

mikkel commented Dec 18, 2018

Thank you. This has been merged into develop. Really cool how the window is resizable! Sorry for the delay.

@mikkel mikkel closed this Dec 18, 2018
@mikkel mikkel mentioned this pull request Dec 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants