Skip to content
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

ni_sh_a.char IDE for Python #170

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 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
54 changes: 2 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,2 @@
# Code-Collection-hacktoberfest2022
This repository is for everyone who wants to participate in Hacktoberfest 2022.
<br>
<h1>Hacktober Fest 2022 For Everyone!👋👋</h1>
<br>
<img src = "https://github.com/AnanyaDas162/LGMVIP-WEBDEV/blob/main/Images/download.jfif" alt= "Its time to contribute!!" height = "100%" width = "100%">
<h1>🎖️🎖️Rewards ::🎖️🎖️</h1>
<h6>You can get awesome goodies like T-Shirt and some stickers for FREE!!!🤩🤩</h6>
<h1>👨‍💻👩‍💻Upload your Projects or DSA related Programs in any Language👨‍💻👩‍💻</h1>
<h6>Use this project to make your first contribution to an open source project on GitHub!!</h6>
<br>
<h1>What is Hacktoberfest?</h1>
<h6>Hacktoberfest is a month-long celebration of open-source software by DigitalOcean that encourages participation in giving back to the open-source community. Developers get involved by completing pull requests, participating in events, and donating to open source projects.</h6>
<br>
<img src="https://github.com/AnanyaDas162/LGMVIP-WEBDEV/blob/main/Images/github-logo-octocat-.gif" style="display:flex; justify-content:center;">
<br>
<h1>Why should you contribute for Hacktoberfest??🤔🤔</h1>
<h6>It encourages developers and also beginners to contribute to open source projects and practice programming by participating in solving problems across projects.</h6>
<br>
<img src="https://github.com/AnanyaDas162/LGMVIP-WEBDEV/blob/main/Images/why-contribute.gif">
<br>
<h1>How to participate??🤔🤔</h1>
<h3>👇👇Steps to follow:👇👇</h3>
<h3>1. Register for Hacktoberfest</h3>
<a href="https://hacktoberfest.com/">Register Here</a>
<h3>2. Add Project/Program in any Language you like:</h3>
<h6>Add any of your simple or complex Project/Program in any language you like in this repository by clicking "Add File -> Create new File".</h6>

<h3>4. Create Pull Request:</h3>
<h6>Once you have completed these steps, you are ready to start contributing by clicking on Create Pull Request.</h6>
<h3>5. Give this Project a Star:</h3>
<h6>If you liked working on this project, please share this project as much as you can and star this project to help as many people in opensource as you can.</h6>
<h1>📝📝Notes :: 📝📝</h1>
<h6>1. Don't Create Pull Request to update "readme.md" File.</h6>
<h6>2. Upload or Create File in Specified Folders.</h6>
<h6>3. If Specified Folder not Found then Create Folder and then Upload or Create File.</h6>
<h6>4. In case you need to add an external package, install it by using npm. Don't push the complete package file here.</h6>
<h3>
5. If you are uploading a Leetcode / GFG problem, then please mention it and upload it in the corresponding folder. And also give the file name same as the problem name.
</h3>
<h6></h6>
<h6></h6>
<h6></h6>
<h6></h6>
<h1>Contributors :: </h1>
<br>
<a href="https://github.com/AnanyaDas162/Data-Structures-Algorithms-And-any-other-project-Hacktoberfest2022/graphs/contributors">
<img src="https://contrib.rocks/image?repo=AnanyaDas162/Data-Structures-Algorithms-And-any-other-project-Hacktoberfest2022" />
</a>
<h6>Thanks for contributing. It's an amazing experience to collaborate with you all!</h6>
<br>
<img src = "https://github.com/AnanyaDas162/LGMVIP-WEBDEV/blob/main/Images/code.avif" >
# ni_sh_a.char-IDE
A simple IDE to execute Python codes
69 changes: 69 additions & 0 deletions ni_sh_a.char/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
from tkinter import *
from tkinter.filedialog import asksaveasfilename, askopenfilename
import subprocess

compiler = Tk()
compiler.title('ni_sh_a.char IDE')
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()
editor.delete('1.0', END)
editor.insert('1.0', code)
set_file_path(path)


def save_as():
if file_path == '':
path = asksaveasfilename(filetypes=[('Python Files', '*.py')])
else:
path = file_path
with open(path, 'w') as file:
code = editor.get('1.0', END)
file.write(code)
set_file_path(path)


def run():
if file_path == '':
save_prompt = Toplevel()
text = Label(save_prompt, text='Please save your code')
text.pack()
return
command = f'python {file_path}'
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
output, error = process.communicate()
code_output.insert('1.0', output)
code_output.insert('1.0', error)


menu_bar = Menu(compiler)

file_menu = Menu(menu_bar, tearoff=0)
file_menu.add_command(label='Open', command=open_file)
file_menu.add_command(label='Save', command=save_as)
file_menu.add_command(label='Save As', command=save_as)
file_menu.add_command(label='Exit', command=exit)
menu_bar.add_cascade(label='File', menu=file_menu)

run_bar = Menu(menu_bar, tearoff=0)
run_bar.add_command(label='Run', command=run)
menu_bar.add_cascade(label='Run', menu=run_bar)

compiler.config(menu=menu_bar)

editor = Text()
editor.pack()

code_output = Text(height=10)
code_output.pack()

compiler.mainloop()