FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
PySimpleGUI/DemoPrograms/Demo_CLI_or_GUI.py at master · PySimpleGUI/PySimpleGUI · GitHub
PySimpleGUI
/
PySimpleGUI
Public
Notifications
You must be signed in to change notification settings
Fork
1.8k
Star
13.8k
Code
Issues
708
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
PySimpleGUI
/
DemoPrograms
/
Demo_CLI_or_GUI.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (19 loc) · 637 Bytes
Breadcrumbs
PySimpleGUI
/
DemoPrograms
/
Demo_CLI_or_GUI.py
Copy path
File metadata and controls
28 lines (19 loc) · 637 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Demo Command Line Application or GUI Application
If your program is run with arguments, then a command line version is used.
If no arguments are given, then a GUI is shown that asks for a filename.
http://www.PySimpleGUI.org
Copyright 2018-2026 PySimpleGUI. All rights reserved.
"""
import
PySimpleGUI
as
sg
import
sys
def
main_cli
(
filename
):
print
(
f'Your filename =
{
filename
}
'
)
def
main_gui
():
filename
=
sg
.
popup_get_file
(
'Please enter a filename:'
)
main_cli
(
filename
)
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
<
2
:
main_gui
()
else
:
main_cli
(
sys
.
argv
[
1
])
Back
|
FazBrowse Home
|
New Git URL