advice sought for program with GUI

2019-02-28 Thread mick crane

hello,
I'm not very good at this stuff, have remembered bits here and there.
Memory seems no so good these days.
I've done pieces of simple calculations on 2D images in the past but 
when I go back and look at them think " now what does that do and what 
did I type to make it work".
I'm thinking that if I do something now I should make a little GUI with 
buttons to click on that are self explanatory.

I know nothing about that.
Is that Gtk or ncurses or something ?
pointers to what's needed appreciated.

cheers
mick

--
Key ID4BFEBB31



Re: advice sought for program with GUI

2019-02-28 Thread tomas
On Thu, Feb 28, 2019 at 08:10:41AM +, mick crane wrote:
> hello,
> I'm not very good at this stuff, have remembered bits here and there.
> Memory seems no so good these days.
> I've done pieces of simple calculations on 2D images in the past but
> when I go back and look at them think " now what does that do and
> what did I type to make it work".
> I'm thinking that if I do something now I should make a little GUI
> with buttons to click on that are self explanatory.
> I know nothing about that.
> Is that Gtk or ncurses or something ?
> pointers to what's needed appreciated.

There are many. For small and simple things, I *love* Tcl/Tk (which is
nicely packaged for Debian). A bit aged, but: very nice integration
of language and GUI toolkit; having been starved from developer power
for some time, its main designers were forced to take clever decisions
(which they did), and it shows.

There's also TkInter -- Tk bindings for Python. It was for some time
the "official" Python GUI

On the other end of the scala there are Gtk and Qt, with bindings to
many languages (C, Perl, Python, etc.); heavyweight, but if you are
aiming at a bigger project definitely worth considering.

Some Tk resources:

  https://wiki.tcl.tk/
  https://en.wikipedia.org/wiki/Tk_(software)
  https://wiki.python.org/moin/TkInter
  https://tkdocs.com/tutorial/widgets.html (recommended: 4 language bindings)

As an appetizer, and to show how language and widget set integrate,
(and the canvas: ah, the wonderful Tk canvas), here's a bidirectional
analog clock in under 30 lines:

  https://wiki.tcl-lang.org/page/counterclock

Enjoy
-- tomás


signature.asc
Description: Digital signature


Re: advice sought for program with GUI

2019-02-28 Thread Curt
On 2019-02-28, mick crane  wrote:
> hello,
> I'm not very good at this stuff, have remembered bits here and there.
> Memory seems no so good these days.
> I've done pieces of simple calculations on 2D images in the past but 
> when I go back and look at them think " now what does that do and what 
> did I type to make it work".
> I'm thinking that if I do something now I should make a little GUI with 
> buttons to click on that are self explanatory.
> I know nothing about that.
> Is that Gtk or ncurses or something ?
> pointers to what's needed appreciated.

There's 'dialog'. Not sure it can do self-explanatory buttons, though
(jocular remark).

curty@einstein:~$ apt-cache show dialog

 This application provides a method of displaying several different types
 of dialog boxes from shell scripts.  This allows a developer of a script
 to interact with the user in a much friendlier manner.
 .
 The following types of boxes are at your disposal:
  yes/no   Typical query style box with "Yes" and "No" answer buttons
  menu A scrolling list of menu choices with single entry selection
  inputQuery style box with text entry field
  message  Similar to the yes/no box, but with only an "Ok" button
  text A scrollable text box that works like a simple file viewer
  info A message display that allows asynchronous script execution
  checklistSimilar to the menu box, but allowing multiple selections
  radiolistChecklist style box allowing single selections
  gaugeTypical "progress report" style box
  tail Allows viewing the end of files (tail) that auto updates
  background tail  Similar to tail but runs in the background.
  editbox  Allows editing an existing file

> cheers
> mick
>


-- 
When you have fever you are heavy and light, you are small and swollen, you
climb endlessly a ladder which turns like a wheel. 
Jean Rhys, Voyage in the Dark



Re: advice sought for program with GUI

2019-02-28 Thread Thomas Schmitt
Hi,

mick crane wrote:
> I've done pieces of simple calculations on 2D images in the past but when I
> go back and look at them think " now what does that do and what did I type
> to make it work".
> I'm thinking that if I do something now I should make a little GUI with
> buttons to click on that are self explanatory.

If there is already a program with full functionality but complicated
user interface, then i'd consider Tcl/Tk for the graphical frontend.

Tcl is not the most comfortable programming language, but Tk is about
the most easy GUI definition language that i know:

#!/usr/bin/wish

proc say_test {} {
  set echo_result [exec /bin/echo "TEST"]
  puts "Output of external program: $echo_result"
}

proc end_program {} {
  puts "Ending"
  exit 0
}

frame .test_frame

label .head_line -text "--- Headline ---"
pack .head_line -in .test_frame

button .test_button -text "Test" -command "say_test"
pack .test_button -in .test_frame

button .end_button -text "End" -command "end_program"
pack .end_button -in .test_frame

pack .test_frame


Have a nice day :)

Thomas



Re: advice sought for program with GUI

2019-02-28 Thread tomas
On Thu, Feb 28, 2019 at 10:10:03AM +0100, Thomas Schmitt wrote:
> Hi,

[...]

> If there is already a program with full functionality but complicated
> user interface, then i'd consider Tcl/Tk for the graphical frontend.

Good point.

> Tcl is not the most comfortable programming language,

Hey! this is the first time I (mildly) have to disagree with you.
Once I got to grips that Tcl is a kind of "inside-out" Lisp
(or a flip-backwards-and-a-half-turn Forth), Tcl is up there
in my favorite bunch. But I must admit that I'm weird.

Especially with more modern Tcls, having won dictionaries and
namespaces (big programs tended to turn pretty unruly with
"classic" Tcl).

The only big caveats you learn with some pain is that Tcl's
extremely simple syntax has its price (among other things,
'{}' grouping "sees" through '#' comments, ouch!).

> but Tk is about the most easy GUI definition language that i know:

Yep. Can confirm this one.

> 
> #!/usr/bin/wish

[...]

Thanks for the nice example :)

Cheers
-- t


signature.asc
Description: Digital signature


Re: advice sought for program with GUI

2019-02-28 Thread Brian
On Thu 28 Feb 2019 at 09:04:10 -, Curt wrote:

> On 2019-02-28, mick crane  wrote:
> > hello,
> > I'm not very good at this stuff, have remembered bits here and there.
> > Memory seems no so good these days.
> > I've done pieces of simple calculations on 2D images in the past but 
> > when I go back and look at them think " now what does that do and what 
> > did I type to make it work".
> > I'm thinking that if I do something now I should make a little GUI with 
> > buttons to click on that are self explanatory.
> > I know nothing about that.
> > Is that Gtk or ncurses or something ?
> > pointers to what's needed appreciated.
> 
> There's 'dialog'. Not sure it can do self-explanatory buttons, though
> (jocular remark).

A default label used for a button can be overridden.
 
> curty@einstein:~$ apt-cache show dialog
> 
>  This application provides a method of displaying several different types
>  of dialog boxes from shell scripts.  This allows a developer of a script
>  to interact with the user in a much friendlier manner.

Alternatives are zenity and yad.

-- 
Brian.



Re: advice sought for program with GUI

2019-02-28 Thread Curt
On 2019-02-28, Brian  wrote:

>> There's 'dialog'. Not sure it can do self-explanatory buttons, though
>> (jocular remark).
>
> A default label used for a button can be overridden.

I'm just going to flat out admit I don't understand what this means and
let myself be the object of any forthcoming derision.

>> curty@einstein:~$ apt-cache show dialog
>> 
>>  This application provides a method of displaying several different types
>>  of dialog boxes from shell scripts.  This allows a developer of a script
>>  to interact with the user in a much friendlier manner.
>
> Alternatives are zenity and yad.
>

Okay.

-- 
When you have fever you are heavy and light, you are small and swollen, you
climb endlessly a ladder which turns like a wheel. 
Jean Rhys, Voyage in the Dark



Re: advice sought for program with GUI

2019-02-28 Thread Brian
On Thu 28 Feb 2019 at 10:24:48 -, Curt wrote:

> On 2019-02-28, Brian  wrote:
> 
> >> There's 'dialog'. Not sure it can do self-explanatory buttons, though
> >> (jocular remark).
> >
> > A default label used for a button can be overridden.
> 
> I'm just going to flat out admit I don't understand what this means and
> let myself be the object of any forthcoming derision.

Look for "-label" in the manual. The "OK" button, for example, can be
made to read "Do it now".

-- 
Brian.



Re: advice sought for program with GUI

2019-02-28 Thread Thomas Schmitt
Hi,

[beginning to deviate from topic]

I wrote:
> > Tcl is not the most comfortable programming language,

to...@tuxteam.de wrote:
> Hey! this is the first time I (mildly) have to disagree with you.
> Once I got to grips that Tcl is a kind of "inside-out" Lisp
> (or a flip-backwards-and-a-half-turn Forth), Tcl is up there
> in my favorite bunch.

When i wrote xorriso-tcltk as demo for a xorriso slave under a GUI master,
i had a hard time with processing shell-style quoted text. In the end my
solution was to let the xorriso slave parse quoted text into a more
machine readable form (FORTRAN inspired, iirc) which i was able to digest
in Tcl.

Another unexpected obstacle was to perform the C-style gesture of pipe(2)
and fork(2) in order to create the slave and to connect its stdin and
stdout to the Tcl program. Single channel is easy. But two-way
communications seems not to be foreseen by Mr. Ousterhout (or i am not
weird enough).
Solution was to teach xorriso how to start and connect to its own
frontends and to let the Tcl script start xorriso which then starts another
instance of the Tcl script as actually working GUI frontend.
(Ok. Probably i am as weird as tomas. Just differing in detail.)


Have a nice day :)

Thomas



Re: advice sought for program with GUI

2019-02-28 Thread tomas
On Thu, Feb 28, 2019 at 12:43:57PM +0100, Thomas Schmitt wrote:
> Hi,
> 
> [beginning to deviate from topic]
> 
> I wrote:
> > > Tcl is not the most comfortable programming language,
> 
> to...@tuxteam.de wrote:
> > Hey! this is the first time I (mildly) have to disagree with you.
> > Once I got to grips that Tcl is a kind of "inside-out" Lisp
> > (or a flip-backwards-and-a-half-turn Forth), Tcl is up there
> > in my favorite bunch.
> 
> When i wrote xorriso-tcltk as demo for a xorriso slave under a GUI master,
> i had a hard time with processing shell-style quoted text. In the end my
> solution was to let the xorriso slave parse quoted text into a more
> machine readable form (FORTRAN inspired, iirc) which i was able to digest
> in Tcl.
> 
> Another unexpected obstacle was to perform the C-style gesture of pipe(2)
> and fork(2) in order to create the slave and to connect its stdin and
> stdout to the Tcl program. Single channel is easy. But two-way
> communications seems not to be foreseen by Mr. Ousterhout (or i am not
> weird enough).

They've become better in both departments. In the second one *way*
better -- with the introduction of channels [1]

> Solution was to teach xorriso how to start and connect to its own
> frontends and to let the Tcl script start xorriso which then starts another
> instance of the Tcl script as actually working GUI frontend.

Hah. I have a little gui which juggles several running instances of
ffmpeg (as transcoding jobs). While it's running, you can drag-n-drop
additional jobs onto it and each job shows a little progress bar and
a couple of controls to cancel and things.

All in all about 700 LOC, but development went smoothly. Of course,
one has to think async to not get messed up.

It seems Tcl has grown a bit since then.

> (Ok. Probably i am as weird as tomas. Just differing in detail.)

This honors me :)

Cheers
-- t


signature.asc
Description: Digital signature