Programming under Ubuntu/Linux environment... Where to start? - Page 1
Forum section: electronics / general

author: edy
author_rank: Super Contributor
timestamp: May 10, 2019, 03:00:58 pm
content: I have a question about what would be a good place to start with respect to programming some applications in an Ubuntu/Linux environment. I am sort of a "noob" but also not entirely.... I used to program years ago, and then got busy and fell out of current knowledge. I switched over to Ubuntu several years ago as my main working machine and have been familiarizing myself with the basics of Linux and didn't bother with programming side yet (I'm just trying to manage the basics of Linux installation/configuration/trouble-shooting).I'll give you some background as to my previous knowledge but I am not sure which direction to go these days as it has been a while, and I want to learn something that will be supported and grow in the future. I will also explain what I would like to do (as far as applications) and my experience thus far.OBJECTIVEI'm looking to create some basic programs that work in a windowed environment on Ubuntu/Linux. I'm using XFCE desktop but the apps shouldn't be desktop-environment dependent. That is, they should be able to work if someone uses Gnome, LXDE, and other Linux distros and whatever they use. The app should create a window that would let me make menus, buttons, dialog boxes, etc... easily... a graphical area where I could plot graphics, for example mathematical functions or perhaps particle-systems interactions, fractal renderings, 2D sprites and eventually perhaps 3D stuff. I assume I would also have the entire availability of GUI elements available like radio buttons, drop-downs, etc. The framework I use would be able to handle all the basics of the GUI yet allow me to do graphics tasks, plotting points, lines, geometrical figures, sprites, etc... to the window area. Capturing mouse clicks in the window, etc. Simple stuff.BACKGROUNDI am familiar with C/C++ but I've seen people use Python which may also be a good option. Many years ago (like in the 1990's) I made a program for SGI Indy Workstation using X-Windows directly. A few years ago I was introduced to QML with the "Built for BlackBerry" (B4B) program, as this framework greatly simplified creating the GUI that stuck to the B4B "standard" look. I've also been exposed to Marmalade SDK (a 2D framework) in MS Visual Studio, also making apps for cellphone. I've seen Qt also mentioned, not sure how that relates to QML and whether it is universal or requires lots of dependencies installed. So the first thing I need to know is what should I be using to make things easy yet versatile and will be able to run a number of years in the future, for sure on most Linux machines and perhaps even other OS's would be a bonus (and even mobile).As far as development environment, again back many decades ago I was using Borland C/C++ and more recently MS Visual Studio, which basically let me code, it would mark up the text so I could see syntax errors, have easy help hyper-links to give me hints as to correct function usage and when I would compile/build the apps it would launch them and let me play around with them. It was an easy workflow, and when ready it would build the app and that would be it, easy to transport to any machine. I imagine it would be more difficult in Linux, as there would have to be some kind of installer/package manager and a way to bring in dependencies if they are not included in the app? In summary, the environment should be able to help make the work as easy to manage as possible.WHERE DO I BEGIN?I would appreciate any suggestions, keeping in mind that I would like to pursue this as a hobby for now but if it opens up opportunities in the future that would be welcome. It should be fairly "easy" (I know that is a subjective term) to set up and start coding, with an environment that makes it fairly easy to get coding, fix/debug errors and produce a first Hello World example with a window on my desktop and options to start drawing graphics and picking up mouse-clicks (like if I click on a button or in some region of my window). Keep in mind I am using Ubuntu Studio 18.04 as my main machine. A framework that handles all the GUI and even graphical functions would be good, plus many other functional libraries to handle the low-level dirty work I would assume would already be available in whatever I end up using.FIRST PROJECT GOAL IDEASAs far as the first project goal... I think I will make a simple Mandelbrot renderer to start. It would open a window, give you some menu options to set parameters, graphical palette, etc. It would render the Mandelbrot. You would be able to highlight a region in the window and it would use the coordinates of the selection to "zoom" in to that region. Or you might click a spot and it would switch to a Julia set of that point.Another idea would be to do a simple particle system. You would open a window, again have a few menus to set up options and parameters. You would have a pop-up "toolbox" that would allow you to draw particles in the window, of different sizes, of different charges (positive, negative, neutral). You would draw a vector in your window and that would be the starting point and direction of your particle. You would then be able to add a bunch of particles, watch them interact and simulate..... So with that said, I appreciate any help you could provide!

author: Ampera
author_rank: Super Contributor
timestamp: May 10, 2019, 03:32:17 pm
content: The great things about Linux is it's one of the most pleasurable environments to be a C/C++ programmer in!There are options for graphical IDEs like you have on Windows, NetBeans is my favourite, and so long as you have GCC installed (or another compatible compiler family like Clang), you should be good to go for basic programs like that. This, however, is not how I like to do things (Unless it's Java, then yeah, NetBeans).I found myself most comfortable programming with terminals, and that's how programming has been done on Linux and Unix since the PDP-7. The flexibility of this is you can still have your different components you'd normally have in an IDE (albeit with some differences), but if you just don't like one, like your text editor, it's easy to pick it up, and swap it out.Since it's easy enough to say, just go NetBeans, I'll explain to you my setup for programming, things you could change or add to it, and then talk about some great libraries to get started with.First step is to get a decent terminal emulator. I use Alacritty, as it's fast, has everything you'd want in a terminal emulator, and nothing more. Kitty is another popular alternative, but feel free to explore. GNOME/MATE Terminal are also good alternatives for beginners (I think XFCE's terminal is also similar, but I don't remember). Main things to learn here is four different key combinations. Ctrl+C is terminate program Ctrl+D is end current terminal (used for ending subterminals and multiplexers like screen and su session), right click to copy selected text, and middle click (click your mouse wheel down), to paste.Next is text editor. I use nano, and I am sure the mere mention of Linux/Unix text editing will get people losing their shit. This can definitely be substituted with a graphical editor if you don't like terminal editors and want things like mouse support. I use SciTE as a basic visual editor, but there's also GNU Emacs (sort of) along with some other options. vi and vim are also popular options for terminal based text editing, but they are, in my opinion, annoying to use, and require a steeper learning curve than a text editor (which should be like a hammer, pick it up and use it), should have.Now, you have everything you need to get started with basic programming, but there's some things you might want to use. Compilers are command line utilities (well /everything/ in Linux is, even graphical programs, but the point is compilers don't tend to have nice flashy GUIs to do stuff with out of the box). So you're gonna have to use switches to get what you want done. the gcc and g++ (for C and C++ respectively) commands will compile and link everything you need, the syntax for this can be easily looked up. What you will likely want is something to automate this, so you don't have to remember what switches to use and make sure you've included all of your source files. GNU make is the standard build automation tool, but since you are starting out, I'm going to tell you to not use it unless you want to. For the vast majority of basic use, a shell script will do just fine.Shell scripts (don't know how much you know, so apologies if I'm getting basic here), are just text files that will execute commands for each line, so you can save your list of build commands to a file, and run them. While extensions don't really matter in Linux, they are still used to help identify files, and these are .sh files, and the command to run them are sh <FILENAME>. These can also be directly executed like a regular program if you add the characters #! at the start of the file, along with the path to the command processor (in most cases either #!/bin/bash or #!/bin/sh). This isn't mandatory, and the basic idea here is you just want your compiler commands.I run Arch Linux, so on my platform, development libraries and runtime libraries are always included in the same package, but this may be different. You may very well want a tool called pkgconf (command is pkg-conf) which will automatically find where libraries are for use in compiling. This is a compiler script I use myself to give a better indication on how this stuff works:Code:cd srcg++ -g manageBuffers.c++ interface.c++ $(pkg-config --cflags --libs ncursesw) -o ../testing/ATEcd ..The switch -g is for gdb, which I will explain shortly, and the $() will insert the output of a command into another command (in this case it asks pkg-config to get the configuration switches/flags for the library ncurses (wide)). -o is the switch that will give you an executable output from the linker, which can be run normally.gdb is the last thing I will cover, which is a command line debugger tool, which, when combined with the -g flag (might not want to include this in final builds, I'm not actually sure where it stores the metadata for gdb, so it might be in the program itself which could end up leaking source code), will allow you do do all your normal debugger things, like breakpoints, stepping, variable watches, and even crazier bullshit. This can be started using gdb <path to executable> and the syntax is often easy to guess your way through, or to just look up.Now for libraries to do what you want. There are graphics libraries and widget toolkits. Graphics libraries (SDL2 being a popular one, and what I use) will provide easy to use graphics commands, and also give environments for things like OpenGL calls. Widget toolkits (GTK and Qt being two popular ones, I use neither) will allow you to create the whole buttons and whatnot things you'd have with a graphical program, useful if you're not planning on going graphics (or even if you are, they usually have some provisions for embedding graphics). There are TONS of widget toolkits, each with their own way of doing things and varying levels of easy to use or pain in the ass, same thing with graphics libraries.So hopefully, this load of text helps explain to you some of the basic tools and workflows used with traditional Linux programming. It is pleasurable to work with, but it's a bit complicated. Don't feel overwhelmed, it's not that bad, and once I knew what I was doing, it felt pleasurably natural to use. If this is too much, NetBeans, among with tons of other IDEs (tool wars here too) are totally at your disposal, and there are easy provisions for basically every language, even weird shit like FORTRAN, Ada, and Pascal if you are so inclined. Documentation is plentiful, guides are everywhere, and google is your best friend.

author: onesixright
author_rank: Frequent Contributor
timestamp: May 10, 2019, 03:51:18 pm
content: TL;DRDepending on the problem your trying to solve I would select the environment.I.e: Why in C if you can do it in bash?Does it need a GUI? How many people are working with it? How frequently is it used? Will it be used X platform? Data being send between systems? Which protocols you need? Security policies? And so on an so-fort.There many roads leading to Rome. Not a single road is perfect. Be practical and learn it the moment you need it. Well that’s how I approach my projects (developing software for a living).Sent from my X using Tapatalk

author: edy
author_rank: Super Contributor
timestamp: May 10, 2019, 03:56:28 pm
content: Thanks, so I just tried my hand at a basic program just to see how much things have differed since my DOS/Windows days. I tried the following program and immediately got errors.... put into a file called "hello.c":Code:#include <stdio.h>#include <conio.h>void main(){clrscr();printf("Hello world.\n");};So I had to do a bit of digging and apparently clrscr() is not a normal function, nor is "conio.h" library... these were DOS throwbacks. After I corrected the code (using stdlib.h and also a different function as alternate to clrscr) I got this which worked:Code:#include <stdio.h>#include <stdlib.h>void main(){system("clear");printf("Hello world.\n");};I used nano as my editor and it marked up the syntax, but that's all. It would be nice to have an IDE that actually tells me when I am typing in the wrong thing or has a way to look-up functions to tell me what other parameters are needed to pass and formats, or constants for settings.To compile, I used "gcc hello.c" and got a file "a.out" that was already set as executable, so I ran it by typing "./a.out" on the command line.Now I'm still feeling 10 miles away from a graphical IDE with GUI framework environment where I can build up a window, interface and draw on it and have it easily compile and let me see my app. Wow this is going to be one steep learning curve... hopefully not so bad.

author: onesixright
author_rank: Frequent Contributor
timestamp: May 10, 2019, 04:01:00 pm
content: @edyHehe. You will get there.I wrote modules for Apache (in C) with just VIM (via ssh). You be fine IDE’s are just luxury What you can do and what I also did. Use sublime with sftp. On save, it uploads the file. And with a ssh terminal open I would run a make file. If it’s all not complex it works fine.Sent from my X using Tapatalk

author: edy
author_rank: Super Contributor
timestamp: May 10, 2019, 04:14:25 pm
content: Quote from: onesixright on May 10, 2019, 03:51:18 pmMy initial applications would be simple... no security policies, no communication protocols, just a stand-alone application running in a Window. I want to create a window, be able to build out a menu and have the GUI handle things. From what I remember, this is done by the framework and it creates "hooks" or some other actions/triggers when you interact with the GUI. For example, if you choose a menu item, it would then launch some function in my program which could perhaps open a dialog box ("modal") with a bunch of different radio buttons, sliders, text box inputs, etc. I would have an OK/Cancel button on there which would then close that pop-up dialog. While all this interface stuff is happening and letting the user easily interact with the app, I would have create a drawing area in my window where I can put pixels down of various colors. For example, if I decide to render a Mandelbrot I would be able to scan my window area and color in each pixel according to my Mandelbrot algorithm.I was doing this back in the day using Borland C/C++ but directly in DOS to a VGA screen. More recently I was doing this using Marmalade SDK developing an app for BlackBerry. But I never got into this on Ubuntu/Linux and using the windowing environment. I want to know where to start to get up and running simply and easily, without having to use a ton of code to get the job done. Surely there must be a framework/SDK that I can utilize the functions in, with some "Hello World" type examples which lets me handle all the user-interface stuff fairly easily. I find that bogs me down a lot. That's why I liked jQuery, dcmegamenu and modal... It would create all the menus and handle all the hovering and highlighting and selection characteristics automatically. Defining the structure of the menu was easy, and it would open up dialog "modal" boxes, fade the background, etc. I need something analogous to that but for Ubuntu/Linux. Graphical IDE would be nice, a way to preview the window or quickly compile and run it and see what things look like would be nice.

author: edy
author_rank: Super Contributor
timestamp: May 10, 2019, 04:46:09 pm
content: Ok so I put together a rudimentary program... here is the code:Code:#include <stdio.h>#include <stdlib.h>void main(){system("clear"); // clear screenint width=80; // width of rendering areaint height=30; // height of rendering areaint max = 100; // max iterationsdouble zoom = 1.0; // zoom factorfor (int row=0; row<height; row++) // scan through (col,row) sized grid{for (int col=0; col<width; col++){double real = (col-width/2.0)*4/width; // set initial complex coordinate (Real)double imag = (row-height/2.0)*4/height; // set initial complex coordinate (Imaginary)double x=0, y=0; // used to track orbitint iter = 0; // iteration numberwhile (x*x + y*y <= 4 && iter < max) // orbit until reach max iterations or > 2 radius{double x_new = x*x - y*y + real; // z^2 + c => zy = 2*x*y + imag;x = x_new;iter++; // next iteration}if (iter < max) printf("x"); else printf(" "); // put pixel};printf("\n"); // get to next row};};And then I compiled it with gcc, and then ran the program and got this:Code:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxNow if only I can build a window, create some menus, allow mouse interaction (to draw zoom boxes) and plot pixels of various colors in a graphical region.

author: onesixright
author_rank: Frequent Contributor
timestamp: May 10, 2019, 04:51:59 pm
content: Had a look at Qt?Sent from my X using Tapatalk

author: RoGeorge
author_rank: Super Contributor
timestamp: May 10, 2019, 04:58:37 pm
content: Try Python with Qt. (e.g. PyQt)

author: edy
author_rank: Super Contributor
timestamp: May 10, 2019, 05:07:16 pm
content: Thanks... I'll look into it.... They should have called it QtPy ...I see they have that too. Also I just had a look at a Qt C++ page. Seems they want you to purchase Qt, although there is an open-source version available. I'll have to do some more research. Meanwhile I am playing around with my text/terminal based Mandelbrot generator. It looks so bad but I am getting nostalgic...I'm working to implement keyboard input to allow you to zoom in and pan around the image. Apparently there is no function to read a keyboard input press without hitting ENTER key, and when you do press keys in the terminal they show up. To get around that, I found a "kbhit" implementation for Linux and basically it waits around until keyboard press, then reads in using getchar. To avoid keys echoing to the screen, if you do hit a key that is not part of a function then it will printf a "blank line" to basically erase it from the terminal, and return to beginning of the line. Sort of like a clear-screen but just a clear-line to clear off the current line so no echoing of random keys. Thankfully the web has code snippets for all this because it is not like what I used to do back in the day.

author: Ampera
author_rank: Super Contributor
timestamp: May 10, 2019, 06:35:42 pm
content: Use SDL2. It's intended for graphics.

author: jmelson
author_rank: Super Contributor
timestamp: May 10, 2019, 09:13:45 pm
content: Look at Glade for the GUI builder. They have a limited number of "widgets" available, but most of the things you'd ever want are there. You pick them out of a menu and assemble into the GUI page you want. The produced file is in XML. You then activate this XML from your favorite language and that program is "called back" from the GUI to notify it that a button has been pressed, or whatever.Glade doesn't do everything for you, but builds the basic framework. You can then add some additional parameters to the widgets to make them accessible from the program, such as to have the program change text in a box, change colors, or whatever.I have used Glade to build GUIs for things that control remotely-operated devices. The "back end" is in c, and it manipulates custom I/O registers.Jon

author: rstofer
author_rank: Super Contributor
timestamp: May 10, 2019, 10:02:32 pm
content: You can certainly use Qt from C++ but there will be more help if you use Python.Google for 'pyqt book pdf' or similar.I am not an evangelist for Python but it sure seems to be popular. I don't care for C++ either so there you go! If I can't do it in Fortran, C or Pascal, I'm not interested.GTK+ is another option and it will work with C.Lots of tutorial info via Google

author: hamster_nz
author_rank: Super Contributor
timestamp: May 10, 2019, 10:54:57 pm
content: If you are thinking of sticking with C, for simple terminal window text stuff that will work on any UNIX system, look atncurseslibrary. I've got the briefest of intros here:http://hamsterworks.co.nz/mediawiki/index.php/Ncurses

author: rstofer
author_rank: Super Contributor
timestamp: May 10, 2019, 11:06:47 pm
content: Given the idea of plotting Mandlebrot sets, I think ncurses is going to be a little limiting. From the OPQuoteThat's a heck of a first project! I think I would look for a project that already displays the set and use whatever environment they used. I wouldn't want to be blazing a trail!

author: hamster_nz
author_rank: Super Contributor
timestamp: May 10, 2019, 11:25:49 pm
content: Quote from: rstofer on May 10, 2019, 11:06:47 pmHummm... A 4k screen, small font, better than 320x200 characters per screen...

author: nctnico
author_rank: Super Contributor
timestamp: May 10, 2019, 11:41:09 pm
content: I'd start by looking at GUI frameworks like QT or wxWidgets and go from there. These deal with many of the underlying OS mess AND allow applications to be cross platform as well. Linux is moving from XWindows to Wayland so you don't want to start new projects based on the XWindows back-end which goes obsolete in a few years.

author: techman-001
author_rank: Frequent Contributor
timestamp: May 11, 2019, 04:34:35 am
content: Quote from: jmelson on May 10, 2019, 09:13:45 pmI agree, Glade RAD makes the whole tedious GUI coding quite fast. I've only ever written one GUI program and that one interrogated a Auspost public postal costing server, added various items and produced the total for quotations.For that I used Gtk2 and Perl with Glade and the whole thing was quite easy I thought. I'm a technician not a programmer by the way.I released it for Linux only and in due course received the following screenshot of my program "Auspost3" running in XP .... running in a VM on a Solaris machine !So I suppose my program was cross platform eventually

author: edy
author_rank: Super Contributor
timestamp: May 12, 2019, 06:08:05 am
content: Thank you all for your advice. I am thinking that Qt Creator for Linux may be a good place to start. I believe there is a package already available that can be installed for a number of Linux distros and it includes an IDE and also lets you write in C++. There also seems to be a lot of QML which seems to be similar to the B4B (Built for BlackBerry) development that I did a few years ago. It provides the structure to create GUI layouts and install various widgets. There may even be a layout editor which lets you graphically design your GUI.I've got to find some online resources/courses/books to look through and see if that is something that I can grasp easily and begin doing basic stuff with. Like I said, it it will let me pop open a window with some menus and dialogs that I can use to set parameters, and then be able to draw to the window (pixel drawing) then I can start working on my rudimentary Mandelbrot drawer. I can capture mouse clicks and be able to allow selection within the window and thereby using the coordinates figure out what area is being zoomed and refresh the window render to the new region being requested for drawing within the Mandelbrot.If anyone has experience using Qt, please let me know what you think about it. A few people mentioned Qt so that sounds like it may be what I look into first. Whether it is QtPy or PyQt, or Qt Creator C++, it sounds like it is fairly easy to learn.... But I will let you know! I have found some resources online, seems to be a lot out there:http://www-cs.ccny.cuny.edu/~wolberg/cs221/qt/books/C++-GUI-Programming-with-Qt-4-1st-ed.pdfhttp://www.arxen.com/descargas/Books/Hands%20On%20GUI%20Programming%20With%20C__%20And%20Qt5%20-%20Lee%20Zhi%20Eng.pdfhttps://qmlbook.github.io/assets/qt5_cadaques.pdfI've downloaded the Qt installer fromhttps://www.qt.io/and will have to see what to do. I assume the bare minimum would be to get the Qt 5.12.3 Desktop gcc 64-bit installed (none of that ARM/Android stuff or any of the extra Charts, WebEngine, etc....) and also Qt Creator 4.9.0 (but without any of the Qt 3D studio stuff), and do I need one of the Qt installer frameworks?

author: Karel
author_rank: Super Contributor
timestamp: May 12, 2019, 08:29:44 am
content: Here's a practical example.In a console, enter the following (assuming you are using Ubuntu 18.04):sudo apt-get install g++ make qtbase5-dev-tools qtbase5-dev qt5-defaultCreate a temporary directory e.g. "Qt Hello World".Create a file "test.pro" with the following content:Code:TEMPLATE = appTARGET = testDEPENDPATH += .INCLUDEPATH += .CONFIG += qtCONFIG += warn_onCONFIG += releaseQMAKE_CXXFLAGS += -Wextra -Wshadow -Wformat-nonliteral -Wformat-security -Wtype-limits -Wfatal-errorsQT += widgetsOBJECTS_DIR = ./objectsMOC_DIR = ./mocSOURCES += main.cppCreate a file "main.cpp" with the following content:Code:#include <QApplication>#include <QLabel>int main(int argc, char *argv[]){QApplication app(argc, argv);QLabel label("Hello world!");label.show();return app.exec();}In the console, run the following commands:qmakemake./testMore examples:https://doc.qt.io/qt-5/qtexamplesandtutorials.htmlDocumentation:https://doc.qt.io/qt-5/index.htmlForum:https://forum.qt.io/

author: edy
author_rank: Super Contributor
timestamp: May 12, 2019, 11:15:44 pm
content: Thanks @Karel. I've downloaded the installer from qt.io (qt-unified-linux-x64-3.1.0-online.run) and checked off to install the basic Qt gcc package and tools (Qt Creator). It is installing now... about 2 GB download for the bare minimum, ouch! I'll try to enter your code and see what happens. I'm following along with that book I linked before by Lee Zhi Eng. Right now I have no idea what I am doing, but hopefully once I get the Hello World example running and start playing around I'll understand better how it all works. I see there are tons of examples available in Qt Creator, hopefully the learning curve won't be too steep.EDIT: I am working through tutorials such as the following:I managed to put together a rudimentary app that has About/Quit menu items, linked in some icons and added trigger actions for each. Very small rudimentary steps:[UPDATED A FEW HOURS LATER....]Ok I watched a YouTube video called "C++ Coding - Drawing Pixels with Qt" found here:...and managed to figure out how to draw to my window, and here is the result so far along with basically the entire app code seen also in this image in the background:Next step is figuring out how to capture mouse clicks in the window, and drawing a "selection rectangle" that I can resize while the mouse button is down, without ruining the underlying Mandelbrot image (or having to refresh it each time). I can then grab mouse coordinates and map it to the region I know is requested to be zoomed and then refresh the Mandelbrot rendering according to the new coordinates/zoom level.