Skip to content

Use subprocess with CREATE_NO_WINDOW flag in ImageShow WindowsViewer#7791

Merged
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:imageshow
Mar 11, 2024
Merged

Use subprocess with CREATE_NO_WINDOW flag in ImageShow WindowsViewer#7791
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:imageshow

Conversation

@radarhere
Copy link
Member

Resolves #7789

The user has found that calling using ImageShow from within a .pyw file on Windows causes a console to appear, as a result of calling os.system from Viewer.

os.system(self.get_command(path, **options)) # nosec

The user has suggested calling subprocess with the CREATE_NO_WINDOW flag to fix this.
https://stackoverflow.com/questions/58943289 / https://stackoverflow.com/a/7006424/4093019 agree with this solution.

Because subprocess.CREATE_NO_WINDOW only exists on Windows, I've added a dedicated WindowsViewer show_file() method for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Showing an image opens a console

2 participants