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 5 years ago.
Improve this question
I basically want to create a full screen window and draw text on it in different colors and sizes (and also update the screen). I've used pygame for this in python and I'm looking for a similar library (should be fairly easy to use).
+1 if it handles input too...
Instead of picking individual libraries, I'll have a go at a quick overview at all of them, as listed in the Graphics section on Hackage.
Basic frameworks:
OpenGL
Part of the Haskell Platform
Used for many small 2 and 3D games.
Examples: lambdacube-engine, roguestar-gl, hpong, monadius, raincat, frag
GTK
cabal install cairo
Used for high quality two-d graphics/vector graphics.
On Hackage
Examples: diagrams, 4blocks, gameclock
QTHaskell
Relatively little use, but when it is used, it is used notably.
Not on Hackage, found here, due to C++ issues
Notable users: Nikki and the Robots, a commercial game.
SDL
cabal install sdl
On Hackage, quite widely used for game-like, interactive apps with 2D graphics.
Examples: haskgame, Eternal10Seconds, HTicTacToe, RainCat, starrover
X11
cabal install X11
Venerable Unix user interfaces.
Examples: xmonad.
GD
cabal install gd
The GD graphics system. Package on hackage.
Examples: wordcloud, sparklines.
HOgre
cabal install hogre
Bindings to the Ogre game graphics system.
Now, besides these game layers, there are many higher level frameworks and tools:
Diagrams
cabal install diagrams
2D vector diagrams (e.g. for math), built on cairo.
Examples: fractals.
Gloss
cabal install gloss
2D graphics, very easy interface, relatively new. See TomMD's comment.
Examples: functional flocking
Cal3D
cabal install cal3d
Bindings to the Cal3D animation package.
Chalkboard
cabal install chalkboard
URL
Read the tutorial
OpenGL-based combinators for generating images, used in teaching.
TeaHS
cabal install TeaHS
URL
A simple library for use creating 2D games, inspired by the Ruby library Tea.
If you're looking for a specialized game library, you have a number of options that you can find here. FunGEn is probably your best option out of those libraries. However, your question seems to suggest a game library would be a bit overkill, if all you're looking to do is draw text and receive input. In that case, you might opt for something simpler like HOpenGL or hsSDL. There are also several other libraries listed here.
Edit: After a bit more research, you might do well using haskgame. I've never used it myself, but it looks like it's got a few functions here that do exactly what you're looking for.
I'd recommend the new Gloss library as an easy way to get good results.
Gloss hides the pain of drawing simple
vector graphics behind a nice data
type and a few display functions.
Gloss uses OpenGL and GLUT under the
hood, but you won't have to worry
about any of that. Get something cool
on the screen in under 10 minutes.
There are also nice examples, such as:
and a nice example building flocking simulators
Alternatively, if it is vectors and text you want to manipulate, the diagrams package on top of cairo can yield very good results.
You could use Qt. That's what the cross platform Nikki And The Robots is using. You can see their source code and take a look at what they're doing.
Related
OCaml comes with the Graphics module which allows the use of a graphical window.
Is it possible to open two graphical window, and switch between them ?
The Graphics module provides machine-independent tools but in case of a negative answer, perhaps it would also be interesting to have solutions for different window system, such as X11.
I looked through the Graphics module API and I don't see support for multiple windows. I would assume Graphics was intended as something useful but simple enough to be part of the base OCaml release.
For more complex graphics, it makes sense just to provide OCaml bindings to an existing library. If I go to opam.ocaml.org/packages and search for "graphics" I see a few possibilities.
I have done OpenGL coding in OCaml but in fact I had to build some wrappers for OS-native GUI functionality to create the windows. This was many years ago, however.
The Graphics module is quite limited and is more intended as a simple basic library for teaching purposes. A possible replacement for Graphics might be the tsdl package which is a thin wrapper around the SDL C library which should work on most platforms.
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 8 years ago.
Improve this question
I'm just starting to look into the world of Functional Reactive Programming in Haskell, and I would like to experiment with GUI programming (with gtk, because of substantial binding) in a reactional setting.
Now, I've been looking a bit at Grapefruit, Reactive-Banana and Buster, and I would like any testament to the joy/horror of using any one or other package.
All I have is these preliminary oppinions:
I don't mind doing some of the binding of the FRP package to gtk myself, as I have an ambivalet feeling about the abstracted backend idea (that Grapefruit has)..
While I find type theory interesting, I also value simple encodings for actual programs, which seems to put grapfruit-records a bit off..
That is, unless of course some of you persuades me to think otherwise :-)
If you just want to use regular FRP, and stay close to the GUI framework rather than using a "pre-made" abstraction over it, reactive-banana is the most viable option, in my opinion. It's explicitly geared around binding to existing frameworks, is designed for "real-world" use (not doing anything too experimental, semantically, that could cause problems), and so on.
You can take a look at reactive-banana-wx to see how to bind an event-based framework to reactive-banana. It's very simple; I wrote a quick binding to Gtk2Hs once (lost the code now, unfortunately), and the file didn't go over 50 lines. It was almost a direct transliteration of the reactive-banana-wx code.
I would recommend against using Buster, for the simple reason that it hasn't been updated since 2009, and doesn't build on GHC 7.
Other "production-oriented" FRP frameworks are sodium (similar to reactive-banana, but it has dynamic event switching (which is coming to reactive-banana soon, but isn't in yet) and a concept of "partitions" for concurrency; however, it's just come out and hasn't seen adoption yet) and netwire (arrowised FRP, quite a different creature to reactive-banana and sodium).
I've been experimenting with FRP myself and so far the only one that's worked for me is Reactive-Banana. I never looked into Grapefruit or most of the others because they were out of date and didn't seem like they were likely to be updated or supported at all. I did briefly look at netwire, but frankly all the arrow theory in it put me off and I had a lot of trouble figuring out how to do even simple things.
In contrast I've managed to get a pretty good set of bindings to SDL written in Reactive-Banana with only a few hiccups along the way. Another thing in favor of Reactive-Banana is that Heinreich is very active in the community and will often provide helpful answers when you run into problems. Just look through the various reactive-banana questions on here and you'll see he's responded to quite a few of them and he's usually very active in FRP discussions in the Haskell mailing lists.
This might seems silly question but for me it is annoying.
I have installed Haskell platform in my PC using Portable option from the installation options as I do not have admin privileges. So the total Haskell files are now stored in D Drive and I am able to use this without any problems. But when I search for GUI programming in Haskell I have got many articles in Google and I came to final conclusion that I need another library or tool or plugin(I dont know which is correct) to make GUI programming possible in Haskell.
But here my questions are:
What are best tools for windows for GUI programming?
How to install the extra library or tool and attach it to
portable Haskell platform?
The Haskell wiki has a comprehensive list of available GUI libraries for Haskell.
The problem with GUI programming in Haskell is not so much the lack of available tools and libraries, but the fact that using Haskell to write GUI programs in the usual imperative event driven style doesn't take full advantage of the functional nature of Haskell.
There are a number of approaches aiming to address this problem, but, as far as I know, they are all pretty much at the "research" stage, meaning they are not yet quite as mature (both in theory and in practice) as the mainstream (non-functional) techniques. If you are interested in this direction, take a look at some of the functional reactive projects listed in that wiki page, as well as reactive-banana.
As for your second question (how to install Haskell libraries), you can use cabal, which is included in the Haskell Platform. This page explains how to install packages with it.
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 2 years ago.
Improve this question
I started learning FORTRAN and need graphic library to plot output
As I'm not familiar with FORTRAN environment, I wanted to ask for recommendation
I'm used to matplotlib, and preferably looking for something similar. Similar in means of available features, and workflow concepts
Searching through Synaptic it seems like PGPLOT is the way to go
PS I know I could wrap FORTRAN code in Python in different ways
I've used PGPLOT, dislin and PLPLOT. In this era I'd use dislin or PLPLOT. PGPLOT was last updated in 2001 and only has a FORTRAN 77 interface, which can be used with Fortran 90/95/2003 but the compiler won't be able to check that your calls have the correct arguments. The other two have Fortran 95 interfaces. Of dislin and PLPLOT, I think dislin to be better documented. dislin also provides widgets for GUI input. dislin is free for some uses; for business uses one is supposed to purchase a license. PLPLOT is open source under the LGPL.
Yes, PGPLOT is an option.
You may also want to look into PLplot: http://plplot.sourceforge.net/
DISLIN - supports several platforms and languages (python included).
Have you considered using VisIt or similar software? VisIt can visualise very large datasets and has a mechanism for in-situ visualization with the libsim library. See this presentation for a nice introduction to in-situ visualization with VisIt: http://calcul.math.cnrs.fr/Documents/Ecoles/Data-2011/CouplageSimulationVisualization.pdf.
See here for the libsim api.
Finally, a few additional notes.
While you sate
I'm used to matplotlib, and preferably looking for something similar.
Similar in means of available features, and workflow concepts
using libsimwould be quite different, but it is very powerful.
and
Right now just general graphic package to plot intermediate data
products. If I do well then perhaps I'll look for package that handles
large data sets. But if I get there I'll probably know what to use
till then.
Rather than write a solution now and then change it to deal with large data sets, why not just write a scalable solution now?
Not familiar with FORTRAN plotting but in most languages a quick way to do easy-to-program static graphics is not to use a library at all but to find that language's equivalent of the C "system()" call, find a program that will do the plotting and write the equivalent of:
1. Write plot data to file.
2. Do system call running plot program with data file argument.
3. [Optional] Delete plot data file.
This gives your program the full functionality of the plot program with minimal programming. The plot data and plot program are likely to be in the disk cache so it's all in memory. It's also easily debugged.
People underestimate the system() call - it gives access to a vast array of functionality including scripting. Some would say it's not efficient or "pure" but the user won't care and it will often drastically reduce the amount of programming necessary. Don't reinvent the wheel.
You can use:
PLplot: http://plplot.sourceforge.net/
gtk-fortran. It is a GTK / Fortran binding which offers also an interface to PLplot: https://github.com/vmagnin/gtk-fortran/wiki
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 8 years ago.
Improve this question
The "joke" question Joel asked during podcast #58 made me all nostalgic for Logo, which was the second language I ever programmed in, after Basic, and which is why I never had any trouble with recursion in college.
Are there any implementations of Logo for Windows or Linux (the platforms I can use) or Mac (because I know I'm not alone in this world)? How can I get the Logo programming language for my computer?
Fire up a terminal on Mac or Linux, and type python, then press Return or Enter. Then type from turtle import *, then Return or Enter. Now type fd(100), then Return or Enter. Hooray! Logo with Python! =D (Windows users can install Python here)
Documentation
For a complete list of commands, see the online documentation. Note that the documentation will tell you to type turtle.fd(100), rather than fd(100), because they chose to use import turtle, rather than from turtle import *. The star method is almost always bad, because it makes it possible to confuse your own functions with those in the module, but in this case it is good, because it lets us control the turtle with proper logo commands.
Saving logo functions
Create a file called shapes.py, and save it somewhere sensible. Add the following code to shapes.py:
from turtle import *
def square(size):
for i in range(4):
fd(100)
rt(90)
def fun(size):
for i in range (10):
square (size)
rt(36)
Now, whenever you want to do logo, navigate to wherever you saved shapes.py before running python. Then, after running python, run from shapes import * instead of from turtle import *. This will import logo along with any custom functions you have defined in shapes.py. So, whenever you make a cool function, just save it in shapes.py for future use.
e.g. interactive session (after running python from the relevant directory):
from shapes import *
square(100)
fun(50)
Cross-platform versions:
http://www.mathcats.com/gallery/logodownloadinfo.html
MacOS X specific:
http://www.alancsmith.co.uk/
Open-source Logo:
http://sourceforge.net/projects/fmslogo
http://www.rz.uni-augsburg.de/~micheler/en/
UCBLogo is my favorite LOGO implementation, and happens to be available for Windows, UNIX (with X11 support for turtle drawing), and Mac OS X, with outdated ports for DOS and Mac OS 9 as well.
Most Linux distros already have it packaged.
It is also still maintained (thanks to cheap labor students at Berkeley), open-source, and very portable (I've run it on various flavors of UNIX, including Linux, and various processor architectures as well).
UCBLogo comes with a fairly comprehensive standard library and good documentation; the source code for the examples in Brian Harvey's "Computer Science Logo Style" books are also included.
Addendum:
papert - logo in your browser is surprisingly featureful, and seems to work in any modern browser.
I'm teaching my kids LOGO successfully on Windows using Elica LOGO. (Kids ages are presently 12 and 10.)
The package's strengths include many "advanced" extensions, beyond the basic 2-dimensional turtle. These include 3-D graphics and simple hooks into the Windows widget world. (You can create Windows forms with buttons, etc., from within your LOGO code.)
Lacks sound/music capability, at least in version 5.5, and the built-in documentation is extensive, with many advanced examples, but it's not very useful in my opinion--due to its incompleteness, and its having many coding examples that contain errors. (But my kids learn more by finding the errors in the programing samples.)
KTurtle - http://edu.kde.org/applications/school/kturtle/ is what you need under linux.
for windows version of kturtle visit windows.kde.org
The best way to teach kids logo now it through TurtleAcademy http://turtleacademy.com .
That's a really cool site for starting learning the logo principles and it's free
To really recreate the nostalgia, you might try running Logo on an emulated Apple II. You can get images of Apple II disks for Logo here and the AppleWin emulator here.
There is a pure-Python version of Logo available at http://pylogo.org/
Here's a good free one for windows
http://www.softronix.com/logo.html
And there's a parellel logo you might look at
http://ccl.northwestern.edu/netlogo/
Also, MIT has a good parallel logo called starlogo
http://education.mit.edu/starlogo/
http://tortue-logo.fr is a browser version of the logo language. It is developped in javascript with raphaeljs (server side with python/django but the interpreter is running on the client side).
It only makes possible to play with the turtle but it may be enough to remind you good time learning how to program. :) i think it should cover the main commands of the LOGO language.
Currently french and english are supported. The french version of LOGO is different from the english one (commands are translated in french). SO make sure to choose the right language on the site.
I hope you'll enjoy
You can use http://www.logointerpreter.com. It's a web based interpreter using HTML5 and JQuery.
Turtle academy online is a god source for learning and experimenting logo