Create a in-browser Python application with a GUI - python

I am teaching a class soon and I want to have users try my platform without the need of installing Python in their computers and to run everything online. I have searched for platforms such as Skulpt, CodeMirror and Trinket and they seem ok for what I want to do. However, I want to develop a GUI for the users to input parameters since there are a lot of options and I don't want users with no Python experience to run the programs from the command line like I do and hide the Python code behind the GUI. I have learnt simplegui recently but I think the GUIs you can create are not visually pleasant and for me this is a big no. I also saw in another post that using Tkinker with a in-browser python implementation is not possible.
So, I would like to know what would be the best combination of in-browser Python implementation and GUI module to reach my goal please?
Thank you so much!

I guess Jupyter could meet your needs. Getting started here.
The Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, machine learning and much more.
The Notebook has support for over 40 programming languages, including those popular in Data Science such as Python, R, Julia and Scala.

Related

How do you turn a Flask app into a Perl plugin?

I have a Flask app using some Python libraries for NLP and audio processing that I want to turn into a Plugin for Audacity. Audacity accepts plugins in Nyquist, Perl, and C/C++. I'm guessing, because of the similarity between Perl and Python, that I should go that route. Audacity's docs are pretty sparse, and I haven't found any very useful tutorials, so I have a lot of questions. Forgive me if they're silly questions - this is really new territory for me. Any and all advice is welcome.
What are the steps necessary to turn that web app into a plugin?
Does creating a Perl plugin mean translating all the Python code into Perl, or just creating a Perl script that calls the Python code?
What does it mean that "scripting is not suitable for providing a service on a web server"?
Our Flask app relies on a large custom-trained model file for Mozilla's DeepSpeech - is it possible to handle very large files in a Plugin?
How do you test a plugin for a desktop app? Where do you see error logs?
Again, be gentle with me! I know these are probably silly questions, but I feel like my PM just dropped me in a foreign country with no map!
Number 1: for perl you need to build a Makefile.PL or use another module packager
Number 2: yes you will have to rewrite your code to perl. You probably could package it but you would have to assume that people installing your package have Python installed
Number 3: Hard to say, maybe they are worried about injecting code or possibly poor memory management from long running scripts
Number 4: You can ship large files, if you're duplicating and releasing other peoples code, it's maybe better to use their installer for it and decouple your code from it
Number 5: there are many ways to test it. You can (and should) decouple the UI from the business logic. The business logic cn be tested with standard unit testing. The UI with something like Selenium. You may also need integration tests to test end-to-end

Excel automation with python

I have been working with excel vba for some period of time related with automation. Now I am planning to upgrade to python. I did a little bit of research on how to implement automation using python. All I see people doing coding with PyCharm or Jupiter, to do an automation user has to have knowledge of python. What I want to know is how to create a tool or standalone application with python that does a repetitive task, calculation or report generation in excel. Where the end user doesn't have to worry about python or codes or learning new technology to accomplish the task.
I know this isn't technically and answer, and since I can't comment yet (too low rep), I'm going to point you to automate the boring stuff with python. I'm sure you can find your answer here plus some!
Here is my answer.
https://github.com/TaeYoon2/ExcelAutomation
This project is a sample excel automation program with python.
I used 'openpyxl' library.
welcome to stackoverflow. Here are a few resources that hopefully get you started on your journey to automating excel tasks with python then wrapping your project up for non-python users.
Python libraries that interface with excel (these are for you to write your excel automation projects)
openpyxl docs
pandas docs
pylightxl docs
more at http://www.python-excel.org/
Wrapping up your project for non-programmers
There are a few options here for your non-programmer users.
Have users run your python project on command line where you give them prompts to respond to for your automation (ie. input excel file name, automation task inputs etc). This is probably the simplest task on your end, but it does expect your users to know how to user command line.
Have users run your python project on command line but you create a graphical user interface (GUI) for them to ease the input field options. This requires some up front work on your end to wrap you input with a GUI of your choice; here are a few tkinter, pyqt.
Note that both of these options require your users to have python on their machine with the proper packages ready to go to execute your project. This can be a lot to ask for non-python users. Therefore finally you could use a packaging software like pyinstaller to wrap up your python project into an .exe
Hope that helps! Happy pythoning

What is the difference between Spyder and Jupyter?

I am learning Python for data science, but my problem is that I still don't understand the difference between Spyder and Jupyter!
I would like you guys to help me to understand the difference, please; I would appreciate that.
Here's just a basic summary of the two tools.
Jupyter is a very popular application used for data analysis. It's an IPython notebook ("interactive python"). You can run each block of code separately. For example, I can print a graph using matplotlib. Create a new block of code and print another graph. There are also cool functions like %timeit that test the speed of your code.
Spyder is an Integrated Development Environment (IDE) for Python like Atom, Visual Studio, etc. I use VS Code and I suggest you install it as well. It's easier to learn and get running. There's also tons of helpful youtube videos due to its popularity.
I prefer to use Jupyter notebook to analyze data whether it be in pandas dataframes or plots. When I'm developing a program or implementing new code on data I already analyzed, I use a text editor like VS Code.
There's a lot more to it, but I think that's all you need to know for now. As you gain more experience you'll learn more about the tools and find your preferences. If you want to know more, there a ton of information about them online with people who can probably explain this much better than I can.
I hope your journey into data science goes well! Just be patient and remember struggling is part of learning. Good luck!
Spyder Pros:
Code completion
Code cells: You can create code cells using Spyder.
Scientific libraries
PDB debugger
Help feature
cons:
Limited to python only.
Bad layout not customizable
Jupyter pros:
Easy to learn
Secure and free server - The Jupyter server can be utilized free of charge.
Keyboard shortcuts makes it easy and fast
Share Notebook
cons:
Not recommended for running long, nonconcurrent errands.
No IDE integration, no linting, and no code-style adjustment.
Read more in detail https://ssiddique.info/pycharm-vs-spyder-vs-jupyter.html

MATLAB to web app

Hi I have a MATLAB function that graphs the trajectory of different divers (the Olympic sport diving) depending on the position of a slider at the bottom of the window. The file takes multiple .mat files (with trajectory information in 3 dimensions) as input. I am trying to put this MATLAB app on to the internet. What would be the easiest/most efficient way of doing this? I have experience programming in Python and little experience programming in Java.
Here are the options that I have considered:
1. MATLAB Builder JA (too expensive)
2. Rewrite entire MATLAB function into Java (not experienced enough in Java)
3. Implement MATLAB file using mlabwrapper and using Django to deploy into web app. (having a lot of trouble installing mlabwrapper onto OSX)
4. Rewrite MATLAB function into Python using SciPy, NumPy, and matlibplot and then using Django.
I do not have any experience with Django but I am willing to learn it. Can someone point me in the right direction?
A cheap and somewhat easy way (with limited functionality) would be:
Install MATLAB on your server, or use the MATLAB Compiler to create a stand alone executable (not sure if that comes with your version of MATLAB or not). If you don't have the compiler and can't install MATLAB on your server, you could always go to a freelancing site such as elance.com, and pay someone $20 to compile your code for you into a windows exe file.
Either way, the end goal is to make your MATLAB function callable from the command line (the server will be doing the calling) You could make your input arguments into the slider value, and the .mat files you want to open, and the compiled version of MATLAB will know how to handle this. Once you do that, have the code create a plot and save an image of it. (using getframe or other figure export tools, check out FEX). Have your server output this image to the client.
Tah-dah, you have a crappy low cost work around!
I hope this helps , if not, I apologize!
You could always just host the MATLAB code and sample .mat on a website for people to download and play with on their own machines if they have a MATLAB license. If you are looking at having some sort of embedded app on your website you are going to need to rewrite your code in another language. The project sounds doable in python using the packages you mentioned however hosting it online will not be as simple as running a program from your command line. Django would help you build a website but I do not think that it will allow you to just run a python script in the browser.

Is there a library or reference around showing how to build a Ribbon menu using PyGTK?

Hey there, everyone. A really random question, but I'm looking to get into some GUI programming with Python, specifically with the PyGTK library. I've only ever done GUI programming with Java/Swing, and I'd like to do some independent, personal projects in Python as a way of learning my way around the language, since it's been something that I've wanted to do for a really long time now, and haven't been able to find time for! But I digress...
I'm a fan of the Ribbon Interface introduced by Microsoft. I know that Microsoft introduced recently a library for .NET allowing users to build programs utilizing Ribbon. While I don't really want to learn IronPython yet, it's still an option for the future. These projects would be build on Linux, specifically Ubuntu, if that makes a difference.
So, finally, my question is this: Is there a library or reference point anywhere that can show me how to build a Ribbon GUI interface? Thank you for all of the advice!
There is ribbon like widgets developed as a part of GSC.
http://arstechnica.com/open-source/news/2007/08/mono-developer-brings-the-ribbon-interface-to-linux.ars
http://mono-soc-2007.googlecode.com/svn/trunk/laurent/src/Ribbons/
http://debackerl.wordpress.com/2007/08/25/soc-ribbons-summary/

Categories

Resources