Creating a Windows Menu Bar in Python - python

So, I have looked around Google, and here, I do get some interesting results, like using Tkinter and some example from YouTube videos, but I don't think I am asking the right question.
Basically, I want to create a GUI, in Python, and I want to be able to use the standard Windows drop-down menu. By this I mean; File, Edit, Help, Etc. Is there some sort of template to create this or do I need to create my own, using button configurations?
I am assuming I am missing a large portion of information, specifically relating to Windows manipulation, in my studies so far.

You are looking for a GUI framework, there are several to choose from but personally I would say the main ones are:
Tkinter comes with python so nothing to download, looks "unixy"
QT & pyQT very powerful, cross platform, big downloads, always looks QT
wxPython Uses wrappers around native controls so small, fast, cross platform, looks native. Especially download & install the documents & examples package - gives you lots of code examples in the searchable demo that you can edit and run within the demo.
I really should mention that my personal favorite is wxPython, as I have used it a lot over the years.

Related

How best to enable non-programmers to run a Python program

I have written a Python script which models an academic problem which I wish to publish. I will put the source on Github and some academics that just happen to know Python may get my source and play with it themselves. However there are probably more academics that may be interested in the model but that are not python programmers and I would like them to be able to run my model too. Even though they are not programmers they could at least try out editing the values of some of the parameters to see how that affects the results. So now my question is how could I arrange for a non-python programmer to run a Python program as easily (for them) as possible. I would guess that my options may be...
google colab
an online python compiler like this one
compiling the program into an exe (and letting the user set parameters via a config file)
something else?
So now a couple of complications that makes my problem trickier.
The output of the program is graphical and uses matplotlib. As I understand it, the utilities that turn python scripts into exe files struggle or fail altogether when it comes to matplotlib.
The source is split into two separate files, one small neat file which contains the model and the user might like to have a good look at it and get the gist of it even if they're not really a python programmer. And a separate large ugly file which just handles the graphics - an academic would have no interest in this and I'd like to spare them the gory details.
EDIT: I did ask a related question here - but that was all about programmers that won't mind doing things like installing python and using pip... this question is in relation to non-programmers who would not be comfortable doing things like that.
Colab can handle the 2 problems, but you may need to adapt some code.
Matplotlib interface: Colab can display plots just fine. But you may want user to interact with slider, checkbox, dropdown menu. Then, you need to use Colab's own Form UI, or pywidgets. See an example here
2 separate python files: you can convert one of them to a notebook. Then import the other. Or you can create a new notebook that import both files. Here's an example.

Python GTK3 Basic Text Editor Like MS Office, LibreOffice

I want to create text editor that have coloring feature, Bold,Italic, ... and too many basically Office Program feature for users of my program. but creating this will take too much of my time. so is there a module, package or code for this ?
Thanks.
Gtk3 already has Gtk.TextView and Gtk.TextBuffer which has the requirements you mention (though might be missing some of the more sophisticated ones of a real Office suite). It can also insert images, and do many other tricks. Of course, you have to provide the commands to do steer the widget into executing each of them.
Another possibility is using a web-based editor, and include webkit in your project.

Python GUI without 'video system'

I'm currently at a crossroads. I'm somewhat versed in Python (2.7) and would really like to start getting into GUI to give my (although mini) projects some more depth and versibility.
For the most part, my scripts don't use anything graphical so this is the first time I'm dipping my toes in this water.
That said, I've tried using pygame and tkinter but seem to fail at every turn to get something up and running (although I had some slight success with pygame)
Am I correct to understand that for both I need X started in order to generate any type of interface, and with that, so I need X to get any type of input (touchscreen presses)?
Thanks in advance!
In order to use tkinter, you must have a graphics system running. For Windows and OSX that simply means you need to be logged in (ie: can't run as a service). For linux and other unix-like systems that means that you must have X running.
Neither tkinter nor any of the other common GUI toolkits will write directly to the screen.
I'm gonna give an alternative answer. If you know HTML, CSS and Javascript (or have time to give it a try) I would recommend using Flask, http://flask.pocoo.org/.
With flask you can create websites but you can also (as I am using it) let it be your GUI. It will work on any device and looks really good :).

Trying to embed a native WINDOWS command line in my Tkinter/Python app

I've done a bit of research and I've played with different graphical kits and was wondering if there was a way to display a native windows command line in my application. So, it'd be something like the command line in Jetbrains products (I think eclipse has one too), but the goal is to have 4 of them.
I've found a piece of linux software demonstrating the core concept of what I want to do and I've attached it at the bottom. Basically, I just want four terminals, and I'm going to have the app handle specific key bindings for "ease of access" tasks. I've used the linked software before and like it, but I thought as I'm exploring python it'd be a good learning experience to write something like this for windows as well!
Thanks in advance!
Edit - Google searching "Windows Tkinter Command Line" and the likes haven't been fruitful :) I promise I googled a LOT before posting here.
I dont know if there is anything readymade for this. Basically, you will need to have a text widget and simulate the output with the subprocess module to directly pass user input to run system commands and append results to the same text widget. You could also consider two windows - one for text input and one for result output.
Here is a link: Calling an external command in Python

How to display a PostScript file in a Python GUI application

I would like to build a cross-platform GUI application in Python that displays PostScript files I generate, among some other stuff. What is the best way to accomplish this? Ideally I would be able to do things like zoom and pan the displayed graphic.
Do any/some/all of the GUI toolkits have something I can drop in to do this, and if so what are they called and how do they work? If necessary, I can convert the postscript file to PDF or a raster format behind the scenes, but I'd rather not do the latter.
I asked pretty much the same question a little time ago. Here it is. Hope it helps.
Note: Poppler is highly undocumented. If you use Gtk for your GUI there are a few working examples. In Qt things are a little harder, and I haven't figured out a way myself yet.
In a word Ghostscript. It's been a while since I used it, but it's cross-platform and you can use it to generate image files which your app could then display, pan, and zoom. I used it to develop and test some pretty involved commercial Postscript code for my own products and under contract for others. It's open source, which came in handy for a couple of use cases I had. Nowdays I believe it does PDF, too.

Categories

Resources