1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Why, when I am starting a PyCharm project from a Python script using TKInter, does...

Discussão em 'Python' iniciado por Stack, Setembro 17, 2025.

  1. Stack

    Stack Membro Participativo

    # OpenPyCharm.py

    import subprocess
    import tkinter as tk

    window = tk.Tk()
    window.wm_geometry("800x400")

    def startPyCharm(project):
    subprocess.Popen(['pycharm64', f'myProjectPath\\{project}'])

    EditButton = tk.Button(window,
    text='Edit',
    command=startPyCharm('myOtherProject.py'))
    EditButton.pack(padx=20, pady=20)


    def main():
    window.mainloop()

    if __name__ == '__main__':
    main()


    This opens PyCharm with 'myOtherProject.py' ready to edit without even pressing the button. Then the OpenPyCharm.py window opens. Then, when I close the PyCharm project, it will not restart when I press the button.

    Continue reading...

Compartilhe esta Página