GUI for Linux?

New to FreeBASIC? Post your questions here.
microchip22
Posts: 1
Joined: Apr 10, 2016 14:45

GUI for Linux?

Postby microchip22 » Apr 10, 2016 15:07

I am new to Freebasic. I need to find an IDE that will work for a Linux Mint. Also is there an IDE which I could use to design a GUI programs which has window forms, file menus, textboxes etc ? I found a program called Firefly, which I installed on a windows 7 machine, but it is not for Linux. I can get the generated exe file to run under Linux Wine. I am trying to completely switch to Linux.
St_W
Posts: 1467
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: GUI for Linux?

Postby St_W » Apr 10, 2016 18:42

There is not such FreeBasic IDE for Linux as of now. Most people use Geany (a generic IDE for many programming languages including FreeBasic). For creating a GUI you can use e.g. FLTK, IUP or GTK. When you use GTK there's also a separate GUI designer, but GTK is more complicated to use than the other ones and does not support other operating systems like Windows or OSX very well.
You can find FB bindings for all three libraries here on the forums.
caseih
Posts: 1354
Joined: Feb 26, 2007 5:32

Re: GUI for Linux?

Postby caseih » Apr 10, 2016 19:25

If you're looking for an integrated development tool like Visual Basic 6 was, there's nothing like that for FB, on most any platform. FB does not have a native GUI toolkit. FB is a general-purpose compiler much like C is. As St_W says, you are free to use one of several GUI toolkits depending on your purpose and target operating system. Geany is a very nice little IDE, and honestly I've never found graphical GUI designers to be all that useful beyond quick simple things, and very limiting. Building a GUI with code is actually not that hard depending on which toolkit you prefer. Typically you create objects like windows, frames, buttons, and so forth and relate them together with simple function calls to make a GUI. Then you create functions that handle events and write code to attach those events to the controls. Sounds much more complicated than it really is. On FB it seems like people seem to prefer Fltk or GTK. I think several people use a simple toolkit called cGui as well. Hopefully they can chime in here.

If what you want is something like VB6, you may have to look to a different program than FB. One program you might be interested in, and which you should be able to install from the Linux Mint software installer is called Gambus. It strives very much to be VB6-like. I don't believe that it's a compiler, but rather an interpreter. But still it may be useful to you.
hedergabor
Posts: 23
Joined: Feb 15, 2013 10:13
Location: Hungary
Contact:

Re: GUI for Linux?

Postby hedergabor » Apr 11, 2016 0:11

I have an idea that (Flatland) _RB_LIB/GUI and FreeBasicGui (FB_GUI) could work for Linux some way, but I still not tested it. I have similar idea about SimpleGUI. Some additional work maybe are necessary, for example because of the applied font library for FreeBasicGui (FB_GUI). As I remember all three GUI library are some kind of so-called 'GUI Simulation' because all GUI appears inside the main native FB graphic window (which created by screen or by screenres). (Originally sGUI's creator Muttonhead called sGUI a 'GUI Simulation') There are two other such GUI tools, the mentioned sGUI and KwikGUI. As I remember KwikGUI is only for Windows, and I guess sGUI also for Windows because they have some similaritites - specially for their very sophisticated and complicated syntax.

---------

Anyway, I guess there are many other possible way for GUI creation for Linux. One simple method is what I tried to support with some ideas in the topic "Is there any real Basic implementation for GTK+ ?" : The main window is the native graphic window, cretated by screenres or with screen. Texts can be printed or drawn many ways in it :
- printed with print or with draw string (but never outside of range of the window !!)
- UTF-8 text can be drawn with Cairo (simple Cairo or Pango Cairo either)
- or text drawn by xfont.bi
- crazy or very expert programmers can do it much more difficult way - like self-made character images in png/bmp (or in other format for the FreeImage library), or with FreeType2, etc. - no, I personally sick of it

FLTK or GTK+ GUIs (like colour chooser or file browser) can be started from the main window.
For UTF-8 text input both FLTK GUI or GTK+ GUI can be applied. For buttons in the main window the simplest method is creating image buttons. (Not more than 15-25 lines of code.)

All can be `multiplatform` (I meant Windows/Linux or theoretically other *nix OS, but not DOS).

Cairo text can be preferably "Lucida Console", or maybe "Courier", because maybe other font types need much more time to be drawn - at least I had such problem.
I can add that the main graphic window has stucked other apps in XP for me (some code examples from FB tutorial too and the FreeBasic Miner did that too), even with sleep 10. But I had no such problem in OpenSUSE, even without any sleep in the code ! It looks like that FreeBASIC naturally borned for *nix OS, or at least for OpenSUSE Linux, at least in my PC. GTK+ GUIs are appearing much slower in my PC in OpenSUSE than in XP, but who minds it.

The only backdraw that the main window can not be resized or full sized to the screen, at least it can not be done easily or elegantly. There are many apps which come with such main window, like Console2.

-------

#caseih : That is Gambas
rolliebollocks
Posts: 2655
Joined: Aug 28, 2008 10:54
Location: new york

Re: GUI for Linux?

Postby rolliebollocks » Apr 11, 2016 4:18

The GUI I developed for flatland will work under linux because it uses Cairo and fbgfx. But I've been using FLTK and it works great. Much more powerful. I develop for both Windows and Linux.
Lothar Schirm
Posts: 333
Joined: Sep 28, 2013 15:08
Location: Bavaria, Germany

Re: GUI for Linux?

Postby Lothar Schirm » Apr 12, 2016 10:29

wxFBE is an IDE with a GUI designer for both Windows and Linux http://www.freebasic.net/forum/viewtopic.php?f=8&t=20284&hilit=wxfbe. Actually it supports wx-c and FLTK, though the support of FLTK was buggy when I tried it some time ago. I do not know if this has become better.
MOD
Posts: 554
Joined: Jun 11, 2009 20:15

Re: GUI for Linux?

Postby MOD » Apr 15, 2016 16:05

That's true, wxFBE is an IDE with an integrated GUI designer, which works on Windows and Linux. However, the Linux builds are pretty old, I didn't get many people to test it, so it might not (but is supposed to) build anymore (and it was never really easy to build it on Linux because of all the dependencies).

In wxFBE the designer works as a frontend for different kinds of code generators. All code generators are supposed to be plugins (.dll/.so). It ships with code generators for xml (as a savefile format) and wx-c. The FLTK generator plugin was never finished/more an experimental code, as I didn't work with FLTK and AFAIK D.J.Peters changed a lot of stuff the last couple of months, so it's outdated for sure. But it's just a plugin and fully open source, so anyone can try to update it, as long as he wants to use it.
Lothar Schirm
Posts: 333
Joined: Sep 28, 2013 15:08
Location: Bavaria, Germany

Re: GUI for Linux?

Postby Lothar Schirm » Apr 15, 2016 16:16

MOD, thank you for your hard work. It is really a big project, but I guess that most people working with Linux will use Geany and GTK+ or FLTK. I think that wx-C is not attractive any more for most users. These may be reasons why you did not get much support from other people. But a good work has the merit in itself, it is never in vain!
dodicat
Posts: 5816
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: GUI for Linux?

Postby dodicat » Apr 15, 2016 17:50

Mod, I use your ide often, due to the fact that fbide cannot use O (ucase) to optimize gcc.
I now have 64 bit Windows 10.
MOD
Posts: 554
Joined: Jun 11, 2009 20:15

Re: GUI for Linux?

Postby MOD » Apr 15, 2016 18:04

Well, I'm using it too on my PC and notebook. It's my main IDE, even though I'm still Π$/- I've never added the function browser.^^

It runs very well on Win7+8(.1)+10. But as I don't use any productive Linux (except for servers without any GUI) I cannot tell, if it still works well. Maybe St_W can add it to his Jenkins builds for Linux.^^
hedergabor
Posts: 23
Joined: Feb 15, 2013 10:13
Location: Hungary
Contact:

Re: GUI for Linux?

Postby hedergabor » Oct 02, 2016 9:16

It is an old topic but I came back because I discovered it was far incomplete. I have some more ideas additionally.

In the last few months I wanted to find an additional GUI for simple FreeBASIC/GTK (FB 0.24 / GTK2) apps, where FB comes with graphic window (as main window), and some GTK2 dialogs can be applied for it (file dialog, colour chooser, etc.).

I did not wanted the FLTK C Wrapper, also not wanted IUP (for FB), as additional GUI. (Later I recognized that IUP for GTK is exactly the proper GUI for such projects what is in my mind, because it comes specific precompiled binaries. This is I would need for Puppy Linux.)

Anyway, I wanted VCLua, but I got trouble with it and I do not want to do anything with Lazarus. (Because my only option recently for VCLua is that I compile the version 0.5 from source.)
So I chose firstly Python SimpleGUI, there are several SimpleGUI, it is probably the simplest one, from Florian Berger). I remembered from the past for Python EasyGUI, I downloaded its tutorial page and discovered that it is exactly what I dreamed of. Than I became little bit curious about Tkinter. I have found some pretty tutorials about Tkinter, with simple nice codes. (In other tutorials there are also some ugly difficult OOP codes for Tkinter which make a wrong sense about Tkinter.) For simplicity and fun Tkinter can be far the best for me. It needs some script(s) for pindent.py for Basic-like syntax, I recently work on my little simple PHP script for that. Than my little Python scripts endlessly shall be what Python seems firstly.

I have looked around for Lua and Euphoria GUIs, because the Python 2 interpreter is about the worst I ever tested. (Actually the language is also the worst for me without converters, but I mainly want GUI from Python.) Lua and Euphoria have much better support than Python for creating little C binary programs. Both need converters for full Basic-like syntax because they are case-sensitive languages.

I found out that there are probably not too much options for almost Basic-like scripting languages to start with :
FOX is too complicated GUI for me. Anyway, I have not seen any code sample yet for FXLua. I saw a very nice code example for IUPLua. The most realistic choice are wxLua and wxEuphoria, but they were not seemed much more simple for me than IUP for FB. But I did not find any simple tutorial with little examples for IUP for FB.

AGS started years ago a useful topic about IUPLua :
"Getting input from user using a simple GUI (IUP/LUA/FB)"

Those stack-things maybe need somewhat modules for simple usage. I will use Tkinter with simple parameter passing and with temporary text file I/O. As I remember Python supports somewhat tricky method to get variable values from a running executable program, but I do not want to use it.

For Euphoria there is an another option : Py. I still not tested it. Maybe it is in early beta stage (for at least about 12 years ?).

PyFLTK can be much more easier with far better support than the FLTK C Wrapper can have. I also believe that FB with the FLTK C Wrapper probably usually shall do better performance than PyFLTK. But maybe I am wrong, I do not mind it. Simpler is better. FLTK2 is already on board there for Python.

Scripting languages bring a huge advantage compared with FB because of distributed libraries. For example : PHP with extensions, Python with side-packages, LuaAIO, ScriptBasic.
I guess for example writing a FB/GTK/PHP/Python(Tkinter) app is a realistic choice for a hobby programmer when he has enough power source in his machine. (But it is not for a Pentium I. 100MHz PC for sure.)

To summarize my things : there is probably no really good method for KISS philosophy for GUI for FB (for multiplatform/Linux programming). It is not because I do not want to express myself clearly about `stupidity` and simpleness. When I wanted always the simplest because I was curious about easy-to-learn programming languages, it led me doing many effort to find the real good stuff, plus there are much more tutorials to read.
hedergabor
Posts: 23
Joined: Feb 15, 2013 10:13
Location: Hungary
Contact:

Re: GUI for Linux?

Postby hedergabor » Oct 02, 2016 9:40

I forgot Cairo.

Just to correct myself : There is no any trouble with Cairo fonts in FreeBASIC 0.24 graphic window. My first FB/Cairo codes were wrong for that, but later I modified my codes and everything became fine. Cairo fonts are very smooth in FB graphic window.
caseih
Posts: 1354
Joined: Feb 26, 2007 5:32

Re: GUI for Linux?

Postby caseih » Oct 02, 2016 14:50

hedergabor wrote:PyFLTK can be much more easier with far better support than the FLTK C Wrapper can have. I also believe that FB with the FLTK C Wrapper probably usually shall do better performance than PyFLTK. But maybe I am wrong, I do not mind it. Simpler is better. FLTK2 is already on board there for Python.

In practice I don't think you'll find any speed difference between a FLTK gui coded in FB and one coded in an interpreted language like Python or Lua.
Scripting languages bring a huge advantage compared with FB because of distributed libraries. For example : PHP with extensions, Python with side-packages, LuaAIO, ScriptBasic.

All FB needs is a .bi file and it can interface with any C-based library out there. PHP, Python, and other scripted languages require specific bindings to be generated, which are a bit more complicated than simply transliterating a C header file into FB.
I guess for example writing a FB/GTK/PHP/Python(Tkinter) app is a realistic choice for a hobby programmer when he has enough power source in his machine. (But it is not for a Pentium I. 100MHz PC for sure.)

To summarize my things : there is probably no really good method for KISS philosophy for GUI for FB (for multiplatform/Linux programming). It is not because I do not want to express myself clearly about `stupidity` and simpleness. When I wanted always the simplest because I was curious about easy-to-learn programming languages, it led me doing many effort to find the real good stuff, plus there are much more tutorials to read.

I'm not really sure exactly what qualifies as simple for you. I guess what is missing from FB is a good object-oriented wrapper for various GUI libraries out there. GTK is nice, but FB only uses the C api for it, which means a lot of boiler-plate code to work with GTK's object system. If we had a wrapper for FB that was analogous to the object-oriented C++ GTKmm library, it may be a lot more simple and comfortable to work with.

Also note that Tkinter is actually a python wrapper around Tcl/Tk. It consists of a python wrapper around an actual entire Tcl interpreter and the Tk GUI library embedded inside the Python interpreter. Works pretty well, but always seemed convoluted to have so many interpreters involved! Tk can be used from within C, so it probably could be used from within FB as well.

To me Python is the perfect language for gluing a GUI (say PyQt or PyGTK -based) to faster code written in other languages. Although in practice pure python is fast enough for my purposes with the existing libraries like Numpy to speed up some things. At one time I wanted to translate the Python C header files into FB so I could write Python extensions and modules from FB. Never quite found time for that.

A lot of people would really like a modern version of VB6. Unfortunately, there's not really a good substitute out there. Gambas is sort of like that, if you don't mind it being strictly interpreted. FB is more like a C compiler with a BASIC dialect. Much more powerful and flexible than VB6 was, but harder to use for the specific RAD GUI tasks than VB6 was.
hedergabor
Posts: 23
Joined: Feb 15, 2013 10:13
Location: Hungary
Contact:

Re: GUI for Linux?

Postby hedergabor » Oct 02, 2016 18:57

caseih wrote :
Tk can be used from within C, so it probably could be used from within FB as well.


Good idea, but my real problem is that Tcl/Tk for Lua and a Tcl/Tk wrapper for Euphoria is not such thing as Tkinter.
I observed that usually a GUI (from C or from C++) comes more difficult syntax in FB than in Lua/Python/Euphoria.

I hope it shall not lead a trouble about licence :
For example, this is a code sample from the EasyGUI 0.97 tutorial, with Basic-like syntax for my poor PHP script. (The script is still buggy for this.) EasyGUI is also somewhat wrapper/subset for Tkinter (as SimpleGUI /by Florian Berger/ is).

Code: Select all

# -*- coding: utf-8 -*-
# UTF-8 , CR+LF

while 1:

msgbox("Hello, world!")
msg ="What is your favorite flavor?"
title = "Ice Cream Survey"
choices = ["Vanilla", "Chocolate", "Strawberry", "Rocky Road"]
choice = choicebox(msg, title, choices)

# note that we convert choice to string, in case
# the user cancelled the choice, and we got None.

msgbox("You chose: " + str(choice), "Survey Result")
msg = "Do you want to continue?"
title = "Please Confirm"

if ccbox(msg, title):     # show a Continue/Cancel dialog
pass  # user chose Continue
else:
sys.exit(0)           # user chose Cancel
endif

end while



It is a question what could do FB with Tkinter. I am still in doubt about Gambas for procerudal programming. I would rather choose Lua or Euphoria with a simple converter. PHP can do that job in a few lines. (Plus the entries for the dictionary.)
hedergabor
Posts: 23
Joined: Feb 15, 2013 10:13
Location: Hungary
Contact:

Re: GUI for Linux?

Postby hedergabor » Oct 02, 2016 19:31

caseih wrote :
All FB needs is a .bi file and it can interface with any C-based library out there. PHP, Python, and other scripted languages require specific bindings to be generated, which are a bit more complicated than simply transliterating a C header file into FB.


For example it is still a theoretical question for me, but my answer rather try PHP GD : GD distributions come with source files. It is easy to compile them in Linux. But I have no any idea how to compile them in Windows. Plus, it can make me embarrassed when I have to learn something which not FreeBASIC just because I need a compiled binary library. Plus, I really fed up with the situation, that only Pelles C and some other such free C compilers are easy enough for installation. (I do not need holly `jamana` about the easiness of MinGW, etc.) So my idea is testing an FB/PHP GD app instead of FB GD. The theoretical question is such app how fast can be in a 700Mhz laptop. (I am sure, that for dual 3GHz processors and with the latest hardwares it could be fast enough with any usual solution. Even with straight hard disk reading/writing.)

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 1 guest