Message Boards Message Boards


[WSG21] Daily study group on creating custom user interfaces

Posted 3 months ago
87 Replies
43 Total Likes

On September 7th we will begin our next Daily Study Group series that will focus on "Creating Custom User Interfaces". Attendees will learn to develop graphical user interfaces using the Wolfram Language through short live lessons hosted by Wolfram-certified instructors, and also work on practice problems and mini projects for a hands-on experience.

A certificate of program completion will be available.

Register here.

87 Replies
Posted 3 months ago

It's gratifying to see so many people excited to learn about user interface technologies available in the Wolfram Language. Looking forward to the enthusiasm at this upcoming study group!

Posted 3 months ago

I am wondering is there a way to vary what type of color setter is presented to the user with the Manipulate function. For example, is it possible to use a LAB Color setter instead of the default color selector in the Manipulate function? enter image description here

Looking for something like this?

   LABColor[lightness, a, b],
 {lightness, 0, 1}, {{a, 0}, -1, 1},
 {{b, 0}, -1, 1}, {{opac, 1}, 0, 1}]

The approach suggested by Mr. Choi is correct.

The standalone version of the built-in LAB color palette can be seen using:


This particular palette works by replacing the selection, and is thus hard to integrate with a Manipulate.

It is possible to emulate the built-in LAB color setter using top level code, but that would require some work.

Posted 3 months ago

On slide 10 of today's presentation, Session 3 - Dynamic Fundamentals I, a correction was made to the following expression:

Control objects:

stop = 1;

 If[stop == 0,
  Button[Style["Start", 20], Background -> LightGreen, ImageSize -> {80, 40}],
  Button[Style["Stop", 20], Background -> LightRed, ImageSize -> {80, 40}]]

To make it work as intended, stop==1 and stop==0 were inserted, but I haven't been able to make the correction properly. Could you please help?

 If[stop == 0,
  Button[Style["Start", 20], stop = 1, Background -> LightGreen, 
   ImageSize -> {80, 40}],
  Button[Style["Stop", 20], stop = 0, Background -> LightRed, 
   ImageSize -> {80, 40}]]
Posted 3 months ago

Today's quiz is a disaster. My answers to questions 2, 5, 9 and 10 are being ignored. I can change my answers to any of these and my score remains unchanged.

Posted 3 months ago

Also, according to the Day 1 notebook, Introduction, slide 8, item 2 under Entirely cloud-based interfaces, the answer to question 3 is being graded incorrectly.

Any idea when the quiz is due? I don't see a due date listed in any of the materials. Thanks.

Posted 3 months ago

Hi Gerrie,

Yes, I agree, grading is messed up on questions 2, 5, 9, 10.

Posted 3 months ago

I have the same issue. In other study groups the due date came after the course was finished.So, it is probably not an issue in this regards.

Hi Everyone,

Just wanted to confirm Quiz 1 should be working as expected. Our apologies for the issues you faced with the quiz last week.

Also we'd like to request that you not post the link to the quizzes here in the public forum. We've created the quizzes specifically for our study group attendees. But we are happy to discuss any questions you may have about the quizzes, here.

Thank you, Abrita

Thank you everyone for your enthusiastic participation in this week's sessions. I hope that you have been enjoying and finding the sessions helpful.

In this week, we covered some fundamental concepts of dynamics and Manipulate.

In the next week, we will discuss more about certain pragmatic concepts related to the development of User Interfaces and look at several User Interface examples.

Our apologies for few things here and there not working properly in the notebooks. We are making the corrections and will make an updated set of notebooks available to you at the end of the series.

Posted 2 months ago

I know Jayanta mentioned how to abort the evaluation once it gets in a loop. I tried command + "." (Mac) but wasn't having much luck. I'm working on Exercise 3 on Dynamics II and have had to restart MMTA twice now.

Thanks in advance

[Cmd]+[.] unfortunately can't always abort a given computation instantly. The abortion request goes to the kernel instantly, but depending on the type of computation the kernel is busy with it may check the queue of requests frequently or infrequently. Besides, the abortion itself may take some time.

That said I did not encounter any such problems with Exercise 3. If we are using preemptive evaluation, we should get an $Aborted in 6 secs. With queued evaluation I get back the image in about 10 seconds (this time will depend on your internet connection).

You may want to check:

Options[EvaluationNotebook[], DynamicEvaluationTimeout]

If the value is not 6, I would recommend resetting it to 6 unless you are using it specifically for some purpose.

You can also try quitting the kernel: Evaluation -> Quit Kernel

Posted 2 months ago
Posted 2 months ago

It does not work because of a typo. Delimiter, not Delimeter.

Is it safe to try the quiz now? Is it grading correctly?

Posted 2 months ago

I am sorry, could someone post the link to the quiz? I can not find it on the group. Thank you and sorry for the added noise!

Posted 2 months ago

I asked the question in today's session:

The documentation for ActionMenu says that Appearance->"Popover" will let you select the default value, but I can't find out how to do that.

I was referring to the following setting choice for the Appearance option:

"PopupMenu" display like a popup menu with initial value name

Where can I specify name?

Posted 2 months ago

name is the first argument to ActionMenu. From the example under Options / Appearance

  "Factorials", {"4!" :> Print[4!], "7!" :> Print[7!], "10!" :> Print[10!]}, 
  Appearance -> a], {a, {None, Automatic, "PopupMenu", "Button"}}]
Posted 2 months ago

This example still doesn't answer my question, but I now see the problem is that the documentation is wrong (though some will probably argue that it's just highly misleading). The first argument, name is used in exactly the same way in all 4 Appearance options.

Based on the description of the Appearance option setting "PopupMenu"

display like a popup menu with initial value name

executing the following

ActionMenu[ "10!",
  {"4!" :> Print[4!], "7!" :> Print[7!], "10!" :> Print[10!]}, 
  Appearance -> "PopupMenu"]

should show a popup menu labeled 10!, such that I could click it and the menu choice 10! would be selected. But that's not what happens, the first choice, 4! is selected. This results in a very bad user experience because the menu label matches one of the choices, but the user still has to manually select that choice.

The description implies, and I would expect, that the choice 10! should be preselected when the menu is clicked.

Posted 2 months ago

The name is just text that is intended to describe whatever is relevant to all the available actions. It is not a default selection. It is up to the programmer to use text that is appropriate and not misleading. A name of "10!" is misleading since that is not the only available action. In the documented example perhaps a better name would be "Select a factorial to compute". Or maybe

  Tooltip["Factorials", "Select a factorial to compute"],
  {"4!" :> Print[4!], "7!" :> Print[7!], "10!" :> Print[10!]}, 
  Appearance -> a], {a, {None, Automatic, "PopupMenu", "Button"}}]

This results in a very bad user experience because the menu label matches one of the choices

Right, so don't do that. :-)

Perhaps ActionMenu is not the right control to use for what you are trying to accomplish. Can you describe the behavior of the UI that you need?

Posted 2 months ago

Either the documentation is wrong or the implementation is wrong (a bug).

I understand the actual behavior, now. My initial question had to do with understanding what the documentation meant. The responses I've received have ignored the documentation of the PopupMenu option and only described actual behavior.

The description "display like a popup menu with initial value name" says this looks and acts like a PopupMenu, but it doesn't. In PopupMenu, the first argument, name, does set the initial value for the menu. I don't have to manually make a selection—what I see is what I get. With ActionMenu and the Appearance->"PopupMenu" option, I get a menu that looks exactly like an ordinary PopuMenu, but does not behave the same. It seems that either the documentation author erroneously assumed equivalent behavior, or that equivalent behavior was intended as documented, and the actual behavior is a bug. At this point I would declare it a bug, since if it looks like a PopupMenu it ought to act like one. If Wolfram doesn't consider it a bug, I would call it a design defect, and the ActionMenu documentation should clarify how the PopupMenu option differs from an ordinary PopupMenu.

My pursuit of this might seem nit-picky, but put yourself in my place. You asked what behavior I need. The answer is, "I don't know yet." I'm developing an application for which I want a UI that doesn't require typing expressions into a notebook. I'm so far very pleased with what I'm learning in this study group, but my purpose here is to try to understand the whole tool set that is available to me. When the implementation doesn't behave as described in the documentation, I waste my precious time trying to figure why I can't make it work, and I waste your precious time trying to help me.

I agree that the documentation could be more clear on this regard. I am forwarding a request to our Technical Support department so that a suggestion report could be filed and the documentation/function could be improved in the future.

Note that we can always add our own code on top of the existing function for extending the set of features. Here is an example of a custom ActionMenu which I think is closer to what you need:

SetAttributes[myActionMenu, HoldRest];
myActionMenu[name_, list_] :=
 DynamicModule[{x = name},
    (x = #; list[[Position[list[[All, 1]], x][[1, 1]], 2]]
      ) &], list[[All, 1]]

The following will behave like an ActionMenu, however the "name" or "7!" will be pre-selected in the menu:

myActionMenu["7!", {"4!" :> Print[4!], "7!" :> Print[7!], 
  "10!" :> Print[10!]}]

I should mention that I have not spent a lot of time in ensuring that the function is stable in different circumstances. The purpose was to give a hint for the solution.

Examples of such custom control objects can be found in the Wolfram Function Repository (I believe that Soumya had discussed during the presentation as well) - see e.g. StyledCheckboxBar.

Posted 2 months ago

Thank you, Jayanta. I appreciate the example. I'm still learning what I can do without customization, but when I'm finally building something, I may also want to customize.

In few examples from the tutorials in Windows 10 I have a couple of appearence issues: For example in the figure below enter image description here

The controls are truncated.

In the next simple command the x symbol at the left appears very small. enter image description here

Both examples are at 100% (zoom) magnification level. Obviously there is a matter of scaling in a laptop screen. All the values at the preferences are in the default values.

Posted 2 months ago

I don't use Windows so I cannot help with the first issue. For the second one the styling can be changed e.g.

Manipulate[x, {x, 1, 3}, 
 LabelStyle -> Directive[Red, FontSize -> 24, FontFamily -> "Verdana"]]

Thank you for your reply. I think in the option inspector should be "somewhere" an option for the default FontSize to be set at 12 globally or for a notebook.

Dear Friends, how can I obtain the same type of sliders and light gray color in the final graphic if I'm using the same code? Do I need to change some initial setting?

Many thanks.



Yes by default the appearances are OS dependent. We can set a generic appearance which should be independent of the OS:

Style[Slider[Dynamic[x]], ControlsRendering -> "Generic"]
Posted 2 months ago


I believe the differences you are seeing are because the visual appearance of controls matches the default appearance of controls in the underlying operating system. The one on the left is Mac OS, the one on the right is Windows. I don't think there is an easy way to make them look identical.

Jayanta, Rohit, Many thanks for your help.

Jorge O

How would you set up two columns where the left column is text and the right column is Mathematica commands such as In/Out. This is format was used by S. Wolfram in his Mathematica Book 4th edition.

Posted 2 months ago

Hi Charles,

I think what you are looking for is an undocumented function MakeBilateral from the AuthorTools package. Check this thread on MSE.

One of the comments in that thread

MakeBilateral is to make documents or parts of documents like the style of Wolfram's old printed "The Mathematica Book", with explanatory text alongside Input/Output cell pairs

Thanks - I'll check it out

Posted 2 months ago

It would be better if you did NOT begin the session with some survey question that blocks the session from opening up on my computer. I am working on the computer while waiting for the session to begin and depending on the sound of the audio to let me know when the session has begun. That is the whole point of signing in early, and the survey question defeats that purpose.

Hi Raymond,

Sorry to hear you faced some issues with the webinar session today. We do use poll questions to allow our attendees to interactively respond during the study group. But they should not interfere with the webinar itself in anyway or prevent it from starting up. If you run into the issue again, please email us at and we can try to troubleshoot it.

Where should I put the Dynamic to control the appearence or not of the frame in this toy manipulate example:

 {x, 0, 1},
 {{frmd, False}, {True, False}},
 Paneled -> frmd

Manipulate being based on top-level code can be tricky sometimes. It seems that we can't use Dynamic around option values e.g. Paneled -> Dynamic[frmd].

Here is a method:

Dynamic[Manipulate[x, {x, 0, 1}, {{frmd, False}, {True, False}}, 
  Paneled -> frmd, LocalizeVariables -> False]]

The disadvantage here is that the entire Manipulate is updated when the checkbox is used. We can use our own frames so that we don't rely on the Paneled option:

  Framed[x, FrameStyle -> Dynamic[If[frameInner, Gray, None]], 
   ImageSize -> {Scaled[1], Automatic}],
  {x, 0, 1},
  {{frameInner, False}, {True, False}},
  {{frameOuter, False}, {True, False}},
  Paneled -> False, LocalizeVariables -> False
 FrameStyle -> Dynamic[If[frameOuter, Gray, None]]

This one will update only the frames and not the entire Manipulate content.

Jayanta, thank you very much for the instructive reply.

Posted 2 months ago

Is it permissible to Overlay a control onto a graphic?

For the "Car Game" I created a background image as a graphic object and the "start"/"Stop" controller

background = Graphic[...] control = ... which toggles as in the car game demo,

But the control can't be used when these are packaged together using

  }, Alignment -> {Center, Bottom}]


Yes, it is possible by using the third argument of Overlay.

Here is an example from the documentation (ref/Overlay#53834658):

Overlay[{Slider2D[], Graphics[{Opacity[.2], Disk[]}]}, All, 1]
Posted 2 months ago

Thank-you, I saw that example but it wasn't immediately apparent how it works. One remaining question .. Does this mean that only one of the overlays can contain controls ?

Yes it seems that the controls from only one layer can be activated. You can however use Row/Column/Grid in that layer for keeping multiple controls.

Posted 2 months ago

I am trying to create UI with muted tones. The blue backgrounds for menu items in PopupMenu, SetterBar, RadioButton, etc., are much too strong. The Background option sets the background for the whole control, not the background for the labels, as I want.

I tried Jayanta's suggestion above using ControlsRendering->"Generic", but, at least for SetterBar on a Mac, it produces a control where you can't even tell what's selected. The Background option does successfully change the text label background, but the control itself is not usable.

How can I manage the background color on the menu labels?

Good point. We indeed do not have full control over the appearance of the control objects and we often encounter problems while trying to integrate these with an interface with a color scheme of our choice (e.g. muted tones as you mentioned).

Those colors in the menu items of built-in PopupMenu/ActionMenu are dictated by the OS and there are no options to control those at present. Making such options available is in the roadmap of our developers though.

In Wolfram Technical Consulting, we have developed several custom control objects (including PopupMenu, RadioButtonBar etc.) using top-level code in which we have lot more flexibility to control the styling. We use those in different projects. Unfortunately those can't be made available publicly. Only the StyledCheckboxBar is available in the public repository.

If you are interested you could contact Technical Consulting, and it might be possible to make those available to you in a discounted price.

Posted 2 months ago

I am trying, without much success, to set a local DynamicModule Variable (x) when a global variable (y) is changed :

y = 1 ;

 Dynamic[y; Print["called"]; x=100, TrackedSymbols :> {y}]; 
 Initialization :> (x = 3*y)]

Where am I going wrong?

Posted 2 months ago

Maybe try this

y = 1;
 Initialization :> (x := 3*y)]
Posted 2 months ago

Jayanta where can we find that utility you use to close the output windows?

enter image description here

Posted 2 months ago

After you downloaded/unpacked the course material you find it as "OutputDeleteUtility.wl" in folder "Supporting Files"

How to control the display of an initial value in PopupMenu? Thank you in advance!

Posted 2 months ago

Hi Pål,

Something like this?

{x = c; PopupMenu[Dynamic[x], {a, b, c, d}], Dynamic[x]}
Posted 2 months ago

I would like to develop UI's that clients can use with Wolfram Player. From the class yesterday it seems that DynamicModule could be used in this way. Is this correct?

ETA: I would like to keep my functions proprietary, i.e. the client would not be able to see the code.

Yes DynamicModule is in general supported in the Wolfram Player. Please see the difference between the Free Player and the Player Pro/Enterprise CDF though, for a comparison of all the supported features.

We will discuss encoding of packages, making the functions ReadProtected etc. for securing the code in Session 10 - Deployment. If your interface is small enough, you could deploy the interface and need not keep code in any separate package. Once again, more about deployment practices are coming in Session 10.

Posted 2 months ago

Thanks, Jayanta. Very helpful. Looking forward to Session 10.

Thank you everyone for your continued and enthusiastic participation in this week's sessions.

Now that we have covered the fundamental concepts of UI development and looked at various UI examples, in the next week we will focus on best practices and various general tips and tricks.

We will start with various deployment practices, then move on to a host of tips & tricks for speeding up interfaces, making our interfaces aesthetically pleasing, improving the user experience, and more.

Looking forward to your active participation in the next week!

We appreciate all the feedback that you have been giving (either positive or negative). These encourage us to continue to serve our user community, and do it even better in the future!!!

Question: Today you pointed out that ImageSize -> Automatic helps speed up slow interfaces. Could you please explain why?

Wrapping the contents with Dynamic and setting ImageSize->Automatic make the contents evaluate only when the particular tabs are clicked. Without these settings, TabView or PaneSelector evaluates all the contents before displaying. Thus the settings help in reducing the initial loading time.

Some more details can be found here: tutorial/Views#23068646

I experiment with PaneSelector command with a toy example which works as expected: i.e.

 {x = 1},
   SetterBar[Dynamic[x], {"Don't press this", 1, 2, 100, "Hi there"}],
   PaneSelector[{"Don't press this" -> "I said DONT PRESS !!!", 
     1 -> "One", 2 -> "Two", 100 -> "You Pressed One Hundred", 
     "Hi there" -> "What is your name ?"}, Dynamic[x]]

However when I wrap the Speak function around the text to hear the message it is played directly once and is not executed when pressing the tab.

 {x = 1},
   SetterBar[Dynamic[x], {"Don't press this", 1, 2, 100, "Hi there"}],
   PaneSelector[{"Don't press this" -> Speak["I said DONT PRESS !!!"],
      1 -> "One", 2 -> "Two", 100 -> "You Pressed One Hundred", 
     "Hi there" -> "What is your name ?"}, Dynamic[x]]

What is going on here ?

Posted 2 months ago

PaneSelector evaluates its arguments before the selector is rendered, they are not re-evaluated when a selection is made. e.g. the random values do not change

DynamicModule[{x = 1}, 
 Column[{SetterBar[Dynamic[x], {"Don't press this", 1, 2, 100, "Hi there"}], 
   PaneSelector[{"Don't press this" -> "I said DONT PRESS !!!", 
     1 -> RandomInteger[10], 2 -> RandomReal[], 100 -> "You Pressed One Hundred", 
     "Hi there" -> "What is your name ?"}, Dynamic[x]]}]]

Thank you for your comment. So there is no chance to play the sound each time I select the setter bar and not at the begining.

Use the second argument of Dynamic:

DynamicModule[{x = 1},
     If[# == "Don't press this", Speak["I said DONT PRESS !!!"]; 
       x = #, x = #] &],
    {"Don't press this", 1, 2, 100, "Hi there"}],
    {"Don't press this" -> "", 1 -> "One", 2 -> "Two", 
     100 -> "You Pressed One Hundred", 
     "Hi there" -> "What is your name ?"}, Dynamic[x]

Attendees in the daily study group had asked about the palette used to delete outputs during presentation. DeleteAllOutputPalette is now present in the Wolfram Function Repository.

Posted 2 months ago

The following code has two problems. extra frame lines inside the SetterBar display are generated and the Dynamic[inputs] appears as a variable name in the blue bar rather than as the value. What is wrong and what are the fixes?

framed[x_] := 
 Framed[x, Alignment -> Center, Background -> GrayLevel[0.96], 
  ImageSize -> {75, 25}, FrameStyle -> None, 
  FrameMargins -> Automatic, BaseStyle -> Bold, 
  FrameStyle -> Directive[None]];
   Framed[Dynamic[input], Alignment -> Center, 
    Background -> LightBlue, ImageSize -> {345, 35}, 
    FrameStyle -> None, FrameMargins -> None, BaseStyle -> Bold],
    framed[#] & /@ {"(", ")", "X", "AC",
      7, 8, 9, "/",
      4, 5, 6, "*",
      1, 2, 3, "-",
      0, ".", "=", "+"},
    Appearance -> "Horizontal" -> {5, 4} , Background -> White
  Frame -> True, BaseStyle -> BackGround -> White]

We will be distributing the solutions to the projects in Session 14.

Posted 2 months ago

Hi Gerald,

I see a couple of typos. Dyanmic[input] should be Dynamic[input], and BaseStyle -> BackGround -> White should be BaseStyle -> Background -> White

Was a recording made of today's (Fri, 24 Sep) presentation?

Posted 2 months ago

can somebody please confirm if recording was made?

Hi Doug, All the sessions from the series have been publish for review. You can go to the series landing page and choose which you'd like to review. You'll be taken to the session page and can hit the play button to begin watching. Please let us know if you have further questions.

Week 3 Recap, Live UI Development and Mini Projects Solutions is not available.

Posted 2 months ago

Is there a way to verify that my quiz results have been recorded?

I took a screenshot of each my quiz test at the final parts, I passed three this Friday. This course is fantastic on making new experience for the user. A lot of coverage, I will review the relevant materials once I have spare times.


Hi Tom,

As long as you see a passing score after hitting "Get Results", your score has been sent to a Databin for review by the Wolfram U team. Quiz scores will be reviewed the week of Oct. 4th and certificates sent shortly thereafter. If you do not receive your certificate, please send an email to, we can pull the data and double check at that time.


When the following code: checkboxBarTest = CheckboxBar[{i, 0, 20, 2}, {i, 0, 20, 2}] is deployed to a CDF, the CDF when opened responds with an undesired "Enable Dynamics" confirmation request.

How can this be avoided?

Thank you in advance and best regards

Hi, there, you can try go to preference dialog, at the security tab, under notebook security, edit trusted directories, put your cdf under one of these trusted directories, then open the cdf files again, the enable dynamic will disappear. this is the simplest way to do it as a Mathematica user,

here are the two technical links on this topic: stackexchange newsgrouparchive

Posted 2 months ago

This course exceeded my expectations. Thanks to everyone who worked to make it a success. Great job!

Posted 2 months ago

Yes, for me it was a very strong course as well.Thanks to all people who made this experience possible!

Thank you so much, Vincent!

TimeConstrained seems not to work when implemented in the Button functionality.

  • Correctly understood?
  • Is there a work around?

Thank you in advance and best regards Pål L

Hello Pål,

It seems that TimeConstrained is supported only for queued evaluations. So this one works:

 x = TimeConstrained[Do[i^2, {i, 10000000}], 1]; Print[x], 
 Method -> "Queued"]

-- Jayanta

Posted 2 months ago

I'm having trouble finding further information on the use of "callKernel" in the Wolfram documentation. I'm hoping someone can direct me to further my understanding or provide an explanation so that I understand more how it functions in examples such as in Session 13 Tip and Tricks for Effective UI design example of a Button disabled until computation finishes ...

DynamicModule[{enabled = True},
  enabled = False;
  Pause[2]; Print[TimeObject[]];
  enabled = True;
  Method -> "Queued",
  Enabled -> Dynamic[callKernel; enabled]
Posted 2 months ago

John again,

No need to answer. On viewing the last session recording I learned callKernel is a dummy variable.

Thanks for the very useful / helpful course materials.

Thank you so much, Jayanta.


Posted 1 month ago

I'd like to use Manipulate to show a dynamic control variable's name and value in a larger font size. The following code yields the name of the scoped variable for "a" rather than its value, for example "a = Dynamic[FE`a$$189]". How do I fix this code so that the value of the dynamic variable appears with font size 20?

 Grid[{{Style["a = " <> ToString[Dynamic[a]], 20]}, {ContourPlot3D[
     x^2 + y^2 + a z^3 == 1, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, 
     Mesh -> None, ImageSize -> Medium]}}], {a, -2, 2}]
Posted 1 month ago

Hi Gerald,

You were close.

  {{Style["a = " <> ToString@a, 20]},
   {ContourPlot3D[x^2 + y^2 + a z^3 == 1, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, 
     Mesh -> None, 
     ImageSize -> Medium]}
 {{a, -2, Style["a", 16]}, -2, 2}]

Also increased the size of the label for the control.

Posted 1 month ago

Rohit, Thanks. Gerry

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract