Merge pull request #3349 from PySimpleGUI/Dev-latest

Demo of "PyCharm Me" Button
This commit is contained in:
PySimpleGUI 2020-08-27 18:16:30 -04:00 committed by GitHub
commit 2bd082724d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,30 @@
import PySimpleGUI as sg
import subprocess
"""
Demo PyCharm Launch - Edit this file button
Quick demo to show you how to add a button to your code that when pressed will open the file
in PyCharm for editing.
Note that this is a Windows version. You'll need a slightly different path for Linux.
Copyright 2020 PySimpleGUI.org
"""
# Change this variable to match the location of your PyCharm folder. It should already have the batch file.
PYCHARM = r"C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.1\bin\pycharm.bat"
layout = [ [sg.Text('Edit Window Using PyCharm')],
[sg.Button('PyCharm Me'), sg.Button('Exit')] ]
window = sg.Window('PyCharm Launch Demo', layout)
while True: # Event Loop
event, values = window.read()
if event == sg.WIN_CLOSED or event == 'Exit':
break
if event == 'PyCharm Me':
subprocess.Popen([PYCHARM, __file__], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
window.close()