Skip to content

Add files via upload #175

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

Merged
merged 1 commit into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added PYTHON APPS/Python IDE/Edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions PYTHON APPS/Python IDE/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
from concurrent.futures import process
from distutils.cmd import Command
from tkinter import *
from tkinter import messagebox
from tkinter.filedialog import asksaveasfilename, askopenfilename
import subprocess
import os

root=Tk()
root.title("Python IDE")
root.geometry("1280x720+150+80")
root.configure(bg="black")
root.resizable(True,False)

file_path = ''

def set_file_path(path):
global file_path
file_path=path

def open_file():
path = askopenfilename(filetypes=[('Python Files','*.py')])
with open(path, 'r') as file:
code = file.read()
srccode.delete('1.0', END)
srccode.insert('1.0', code)
set_file_path(path)

def save():
if file_path=='':
path = asksaveasfilename(filetypes=[('Python Files','*.py')])
else:
path=file_path

with open(path, 'w') as file:
code= srccode.get('1.0', END)
file.write(code)
set_file_path(path)

def run():
if file_path == '':
messagebox.showerror("Python Ide","Warning Save Code")
return
Command = f'python {file_path}'
process = subprocess.Popen(Command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,shell=True)
result , error = process.communicate()
output.insert('1.0', result)
output.insert('1.0',error)


#icon
#logo=PhotoImage(file="logo.png")
#root.iconphoto(False, logo)

#code input pane
srccode = Text(root,font="cosolas 18")
srccode.place(x=160,y=0,width=680,height=720)

#code output pane
output = Text(root, font="cosolas 12",bg="black", fg="lightgreen")
output.place(x=860,y=0,width=420,height=720)

#button
Open=PhotoImage(file="C:/Users/Shivam/AppDev/PCE/open.png")
Save=PhotoImage(file="C:/Users/Shivam/AppDev/PCE/Save.png")
Run=PhotoImage(file="C:/Users/Shivam/AppDev/PCE/run.png")

Button(root, image=Open,bg="#323846",bd=0,command=open_file).place(x=30,y=30)
Button(root, image=Save,bg="#323846",bd=0,command=save).place(x=30,y=130)
Button(root, image=Run,bg="#323846",bd=0,command=run).place(x=30,y=230)

root.mainloop()


Binary file added PYTHON APPS/Python IDE/open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Python IDE/run.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Python IDE/save.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.