Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
The community reviewed whether to reopen this question 7 months ago and left it closed:
Opinion-based Update the question so it can be answered with facts and citations by editing this post.
Improve this question
I'm writing a small sudoku game/solver in Linux using python with TUI (not GUI, that's just lame) just for fun. My question is, which lib is better (by that I mean easier to handle, better support, more straight-forward and understandable), the choices are curses or urwid or if anyone have better suggention, and why? I have some Tkinter and wxPython experiences.
Any help or information will be appreciated.
You might want to check out Unicurses, which wraps the python core curses module in UNIX systems and wraps the free pdcurses library on windows-based machines.
This library is designed to emulate the syntax and style of the original ncurses library, so if you're interested in learning TUI design using curses-style programming, then check it out.
Urwid is, from what little documentation I've read, a very interesting library which uses event loops (the reactor pattern) as a basis for application design, much like tkinter or Twisted. Also, urwid has an event loop class specifically designed for use with Twisted, so if your aim is to created TUIs for use over networks, its a good choice. Twisted also uses the reactor pattern, so if you want to learn that style, I'd recommend it.
Finally, if you do go with an ncurses-style library, check out Dan Gookin's book on ncurses. A very good resource, and the only one I know of which is in print today.
There are other options such as newt, pygcurses, and so on, but this should get you started. Best of luck, TUI programming today is one of those technological fetishes that can be hard to break into, but it's rewarding.
While the above is a perfectly reasonable solution for Linux, The OP asked for other suggestions and a justification for them.
Who wants to use a low level API like curses in a modern OO language like Python? Let alone if you are stuck inside Windows (which the OP isn't, but is a problem for a lot of people out there)... There must be a better way.
To try to resolve this, I have put together a simple cross platform class (yup - Windows is included without falling back to PDcurses) to do all the things most people want from their terminal/console. If you're on Linux this is a more human way to program curses. If you're on Windows, the same class works as is with no external binary dependencies. You can find the Screen class in asciimatics.
In addition, I've created a load of highr level objects to create animations and TUIs. For example, this is a recording of a sample using the TUI widgets:
If there's an extra feature you need, let me know and I'll see what I can do.
If your game will run inside a console, then just pick curses.
If your game will run as a GUI application, then just pick PySide.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I'm new on the programming world using python, so i have some questions for desktop aplications development.
1. Im currently using pycharm as my idle, can i use it for my purpose?
2. Can i use peewee as my ORM and Tkinter for my GUI? or should i just use Tkinter?(Recommendations are welcome)
3. I'm planning to use Sqlite3 as my database, should i keep this idea?
My further plan is to make an application to store the networks equipments in an enterprise, like desktops, laptops, switches, etc.
And also get some reports like to wich user belongs a desktop or laptop, wich kind of license does the equip has, a bitacore to store all what happens to an equip, etc.
I'm very new on this world and have been reading, practicing and taking courses for 3 month by now to understand concepts, learn about programming, etc.
Tahnks for the tips.
If you know Tkinter then stick with it, otherwise consider a higher level framework like PyGUI, PySimpleGUI or QT (Arguably not that simple, but plays nicely with PyInstaller). You will definitely be able to keep using SQLite3, as there is an existing binding in python 2&3.
If you plan to deploy this app, then you need to consider if speed is going to be a problem. Python is great but fundamentally quite slow. You can use things like Cython or PyPy to speed it up, but this can get complicated when you look at using a packager such as py2exe or PyInstaller for distribution.
best of luck.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I have a background in structural programming (Pascal,Ada) and now I have been programming an app in Java because I needed to use a given package that was only available for Java,C++ and Python. I chose Java, but I think it was not the best idea as I am not into OOP and I am programming it in a structural way, this is, only with methods and the main program,avoiding to generate objects and those Java things.
Now that I have the "app" running in the windows console I need to generate a GUI to operate it, but before going to hell with Java and objects I would prefer to change to another programming language that permits me to constract the GUI with my structural programming mindset (if it is possible).
I have read that Tkinter in Python and GTkAda in Ada could be my saviours. In case of not being possible I guess I should try to get into OOP.
Thanks in advance
GtkAda is also object-oriented, and so is any other high-level GUI toolkit I've seen so far, so I don't think you can avoid object-oriented programming for the GUI, unless you use a more low-level approach.
Two more low-level approaches are:
An HTTP/HTML based interface.
Using the X protocol to talk directly with an X server.
Both of these approaches can be used with Ada, and probably also with Python. I don't know for sure if Python can do the necessary low-level formatting to talk with an X server, but it must be possible somehow.
If you're looking to use Python, try out PySimpleGUI. There are objects in use, but you don't have to do any object programming. You can copy and paste the "design patterns" without having to know exactly what they do. It was developed with beginners in mind, but can also support advanced, customized window layouts. Look at the Cookbook for code examples. You mostly need to learn how to do a "layout". You will not have to write the word "class" in your code, promise.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm interesting in making games in my future, and I've heard that my favourite game's engine is made with c++, but its embedded with python. I have little experience with programming, but I greatly understand how object orientation works.
Why would someone need/want to embed a scripting language into a programming language?
The main reason obviously is to allow to provide extensions to the game engine without need to recompile the entire game executable program, but have the extensions loaded and interpreted at run time.
Many game engines provide such feature for extensibility.
... but I greatly understand how object orientation works.
Object orientation comes in with the interfaces declared, how to interact with the particular scripts.
So python is itself an object oriented language which supports OOP principles quite well.
For instance integration of non OOP scripting languages, like e.g. lua scripts (also oftenly used for extensions), makes that harder, but not impossible after all.
There are many reasons, but the primary motivations are customization and "playback". By playback, I mean the ability to automate or repeat a series of tasks in the program without requiring programming expertise. Blender is a good example of this.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm wondering if python is a good choice to develop a desktop application for a small business.
Is it possible to build something using PyQT or even Swing + Jython ? How I can make a executable file at the end?
I've found Python to be an excellent choice for developing a broad scala of applications including desktop applications. I've developed in C++ for many years, and for parts that are really time critical I sometimes use it still, but for most of my code Python helps me get results much faster. There are several ways to get an executable. Py2exe is one of them, Cython another option allowing easy combination with C++ if you need raw speed, interfacing with 3rd party libaries or low level control of devices. It also makes reverse engineering a bit harder, if that's a concern in your project.
By the way, when I started out with Python I was very concerned about performance and (being a quality manager at that time) almost blocked its introducion in our company for its lack of strickt typing. I was wrong about both. Since especially the rich set of built in datastructures as well as many of its standard modules are written in C++ and have been carefully optimized, it isn't so easy to beat on speed and memory efficiency as one might think. And the dynamic typing (only recently introduced in a language like C#) proved a very powerful means to write concise, readable, reliable and compact code.
I don't have shares (since Python is open source anyhow) but from all the languages I've used in the past (Algol, Pascal, Modula II, Assembler, Basic, Fortran, Cobol, C, C++, C#, Java, JavaScript) it's the one I prefer rightnow to earn a living with.
It depends on what you are looking to do. I have done it and it worked but there are other questions that can factor in like who will maintain or update the code, and do they know Python. You can look at cx_freeze for making a windows executable out of a python program as one of many options.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
After doing web development (php/js) for the last few years i thought it is about time to also have a look at something different. I thought it may be always good to have look of different areas in programming to understand some different approaches better, so i now want to have look at GUI development.
As programming language i did choose Python where i now slowly get the basics and i also found this question:
How to learn python
which already contains good links and book proposals. So i am now mainly looking for some infos about PyQt:
Tutorials
Books
General tips for GUI development
I already looked at some tutorials, but didn't find any really good ones. Most were pretty short and didn't really explain anything.
Thanks in advance for advises.
The first thing to realize is that you'll get more mileage out of understanding Qt than understanding PyQt. Most of the good documentation discusses Qt, not PyQt, so getting conversant with them (and how to convert that code to PyQt code) is a lifesaver. Note, I don't actually recommend programming Qt in C++; Python is a fantastic language for Qt programming, since it takes care of a lot of gruntwork, leaving you to actually code application logic.
The best book I've found for working with PyQt is Rapid GUI Programming with Python and Qt. It's got a nice small Python tutorial in the front, then takes you through the basics of building a Qt application. By the end of the book you should have a good idea of how to build an application, and some basic idea of where to start for more advanced topics.
The other critical reference is the bindings documentation for PyQt. Pay particular attention to the "New-style Signal and Slot Support"; it's a huge improvement over the old style. Once you really understand that document (and it's pretty short) you'll be able to navigate the Qt docs pretty easily.
I had this bookmark saved:
http://www.harshj.com/2009/04/26/the-pyqt-intro/
There is a step-by-step guide at popdevelop.com on how to set up Eclipse with PyQT.
My advice would be: have some particular goal in mind, some app that you, or even better someone else, would use in a real world scenario.
I started with the same book Chris B mentioned, i.e. Rapid GUI Programming with Python and Qt and I found it useful and it touched many of the topics you would need in most GUI applications. Additionally, after some time and some confidence gained, you want to have PyQT Classes handy.
Do not avoid C++ examples to explain some problem you'd like to solve, rewriting it in Python is not that hard (depending on the problem, and scope of course).