Is there a terminal widget library compatible with Python 3? - user-interface

I'm looking for a terminal UI library providing widgets like buttons, checkboxes and so on, that is compatible with python3.
I've tried:
pycdk (pyrex does not work with python3, and porting it is a mess)
urwid (does not work with python3, it has a port but not working well with new curses interface).
Does anyone know such a library?
Thanks!

Cython supports Python 3, and I was able to make Cython accept the pyx file by changing all __new__ to __cinit__.
Note that the examples still needs some porting to Python 3 at that point. I get "TypeError: expected bytes, str found" when trying to run the examples. Switching all the strings to bytes worked.
Possibly it would be better if the API accepted strings under Python 3 too, but that is definitely more work.

Related

How and which graphing library to install on Python 3

I have Python 3 on OSX Yosemite installed with Brew. I want to make some simple charts (like in Excel). I run Python from bash. Which library should I investigate, and the proper way to have it installed? I am looking for library which is easy to install, and then easy to use. Output probably png files?
matplotlib is a good choice.
How to install it on OS-X is mentioned in the installation FAQ.
Especially in combination with IPython notebooks it gives you a nice interactive environment to play with it.
Another alternative would be gnuplot. Pre-built packages are available.
It is not tied to Python, it is basically a domain specific language for graphing. There are python bindings available, gut it is also not difficult to use it with subprocess.
If you can use commercial libraries, you may also consider ChartDirector.

include pygame in your program

I'm about to finish a program which uses Pygame, which means you would need to install Python and Pygame in order to run the game. How can I include Python and Pygame in the program itself, or is there an easy way to make an installer for the game?
py2exe seems to be a popular answer, and I would suggest looking into it as well. I would also suggest trying pyinstaller. The setup is a bit more involved, but the tutorials are great.
Like PygameNerd said, I would suggest looking into py2exe. I wrote a game for a game jam and wanted to distribute it to people in my dorm. I used py2exe to load it up and distribute it pretty effortlessly (especially using Pygame).
Check out the py2exe website as well as this link on working with various modules in your package. I had dependencies with wxPython and used the latter guide to much success.

Using python library for GIST feature extraction on Windows

I just started using Python (version 2.7.2) on Windows 7.
I want to use GIST feature in my python project. I have been looking around for the GIST python library. There is a famous library called pyleargist (http://pypi.python.org/pypi/pyleargist/1.0.1#downloads).
However, I have tried so many ways to build and install this library on Windows7. Unfortunately, it didn't success at all. Therefore, I would like to ask 2 questions here.
Is there any other alternative python library (apart from pyleargist or writing it myself) for GIST image descriptor?
Have any of you ever been able to use pyleargist library for any Python 2.7 code on Windows7?
Thanks

Haskell or Ocaml with OpenGL and SDL precompiled distribution for Windows

I want to learn Ocaml or Haskell and I want to do it by writing a simple game. Apparently, there's one small problem: nobody cares about Windows and I want to do it on Windows, natively.
Haskell has Cabal, which has SDL, but it doesn't build due to a trivial problem with no workarounds (order of parameters passed to gcc). Ocaml doesn't even have that, it's all in source packages, be it GLCaml or OcamlSDL or whatever.
Is there a place where I can get a working SDL for Haskell or Ocaml on Windows without fighting with a dozen versions of compilers?
The Haskell Platform comes with a binding to OpenGL which should work out of the box on Windows.
Concerning the SDL package on hackage, you can use cabal unpack SDL to get the source code and fix things yourself. To install the package with your changes, run cabal install in the unpacked directory. In any case, drop a line to the maintainer, I'm sure he'll help out.
It's not related to SDL, but you've mentioned OpenGL. There is LablGL binding for OpenGL in OCaml which works out of the box. Wiki example (http://en.wikipedia.org/wiki/Objective_Caml#Triangle_.28graphics.29) compiles and works just fine.
The best instructions I've found for getting SDL to work in windows with a the most recent Haskell platform can be found at this blog. I followed everything step-by-step and it worked perfectly, despite some configure error messages.
It isn't SDL but GLFW works on Windows with Haskell through Cabal.
My article High-fidelity graphics with OpenGL 2 (25th Feb 2008) explained how the GLCaml bindings can be used to write OpenGL-based applications in OCaml that use vertex and fragment shaders (a phong shader is given as an example). There are 9 articles in the OCaml Journal on OpenGL, albeit mostly using the older LablGL library for OpenGL 1.1.
I tried and failed to get OpenGL working from Haskell under Linux in 2007. The Haskell Platform may have changed that but I have neither had time to try it yet myself nor ever heard of anyone using it for this.
However, both OCaml and Haskell must rely upon fragile low-level bindings to OpenGL because they are standalone languages and nobody has ever managed to get any significant commercial software using them to work. As you're on Windows, F#+XNA is a far more logical choice because XNA is tried and tested and F# has a safe high-level interface to it. A Google fight gives you a good idea of what a pioneer you'll be: +haskell +opengl gives 437 hits on Google and +ocaml +opengl gives only 347 hits.

Annotate images using tools built into OS X

I want to overlay text on images on OS X, preferably without installing additional software, so that, as a sysadmin, I can know at a glance that machines are up-to-date, in a way that is easily scriptable and easily modifiable, and can run without GUI access. [Being able to overlay images or apply color-changing effects would be a bonus.]
Mac OS X Leopard comes with a ton of stuff built-in: Perl, Python, Ruby, Tcl/Tk, Bash; wxWidgets, some Quartz integration, and even Objective-C integration for Python and Ruby. There must be several good ways to do this, if I were only versed in these systems.
I'm continuing to go through the examples in the /Developer folder on my computer, and I have got a partial idea of how this might be done in Cocoa and converted to PyObjC. I decided I would have to deploy ImageMagick, but in my testing, I am running into an infamous bus error, and would prefer not to have to compile ImageMagick or GraphicsMagick with all its dependancies if I can do what I need to out-of-the-box. [That said, I would consider installing additional components, but it would be a big win to have something that would work on a stock install of OS X].
This seems like it'd be relatively simple to do using Python and the Python Imaging Library (PIL). I don't think PIL is installed with OS X by default, but it's relatively easy to install manually and doesn't have a ton of dependencies. The PIL tutorials are also pretty good -- it shouldn't be too hard to whip up a command-line or GUI program to do what you want.
CocoaMagic is a single-file replacement for large parts of RMagick (Ruby integration with ImageMagick or GraphicsMagick). It should be useable as a library in its own right, or by appending things to the bottom of the script.

Resources