Group Abstract Group Abstract

Message Boards Message Boards

[WSG21] Daily study group on creating custom user interfaces

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

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 BY: Lou D'Andria

The approach suggested by Mr. Choi is correct.

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

CellPrint[FrontEndResource["LABColorValueSelector"]]

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 BY: Jayanta Phadikar

Looking for something like this?

Manipulate[
 Graphics[{
   LABColor[lightness, a, b],
   Opacity[opac],
   Disk[]}],
 {lightness, 0, 1}, {{a, 0}, -1, 1},
 {{b, 0}, -1, 1}, {{opac, 1}, 0, 1}]
POSTED BY: James Choi

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 wolfram-u@wolfram.com, we can pull the data and double check at that time.

POSTED BY: Cassidy Hinkle
Posted 4 years ago

POSTED BY: Gerald Dorfman
POSTED BY: Jayanta Phadikar
Posted 4 years ago

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

POSTED BY: Tom Blanton

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 BY: Jayanta Phadikar
Posted 4 years ago

Maybe try this

y = 1;
DynamicModule[{},
 Dynamic[x],
 Initialization :> (x := 3*y)]
POSTED BY: Updating Name

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 BY: Jayanta Phadikar
Posted 4 years ago

Jorge,

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.

POSTED BY: Rohit Namjoshi

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

POSTED BY: Peter Burbery
Posted 4 years ago

Rohit, Thanks. Gerry

POSTED BY: Gerald Dorfman
Posted 4 years ago

Hi Gerald,

You were close.

Manipulate[
 Grid[
  {{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 BY: Rohit Namjoshi
Posted 4 years 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?

Manipulate[
 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 BY: Gerald Dorfman

Thank you so much, Jayanta.

PÃ¥l

POSTED BY: PÃ¥l Lillevold

Hello PÃ¥l,

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

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

-- Jayanta

POSTED BY: Jayanta Phadikar

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.

POSTED BY: John Burgers

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},
 Button["Print",
  enabled = False;
  Pause[2]; Print[TimeObject[]];
  enabled = True;
  ,
  Method -> "Queued",
  Enabled -> Dynamic[callKernel; enabled]
  ]
 ]
POSTED BY: John Burgers

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

POSTED BY: PÃ¥l Lillevold

Thank you so much, Vincent!

POSTED BY: PÃ¥l Lillevold

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 BY: vincent feng

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

POSTED BY: Andreas Rudolph

Hi,

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

POSTED BY: PÃ¥l Lillevold

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

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.

POSTED BY: Cassidy Hinkle
Posted 4 years ago

Hi Gerald,

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

POSTED BY: Rohit Namjoshi
Posted 4 years ago

can somebody please confirm if recording was made?

POSTED BY: Doug Beveridge

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.

Thanks.

POSTED BY: vincent feng
Posted 4 years ago

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

POSTED BY: Tom Blanton

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

POSTED BY: Matthew Heaney

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

POSTED BY: Jayanta Phadikar

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

POSTED BY: Jayanta Phadikar

Use the second argument of Dynamic:

DynamicModule[{x = 1},
 Column[
  {
   SetterBar[
    Dynamic[x, 
     If[# == "Don't press this", Speak["I said DONT PRESS !!!"]; 
       x = #, x = #] &],
    {"Don't press this", 1, 2, 100, "Hi there"}],
   PaneSelector[
    {"Don't press this" -> "", 1 -> "One", 2 -> "Two", 
     100 -> "You Pressed One Hundred", 
     "Hi there" -> "What is your name ?"}, Dynamic[x]
    ]
   }
  ]
 ]
POSTED BY: Jayanta Phadikar
Posted 4 years 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?

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

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. https://resources.wolframcloud.com/FunctionRepository/resources/DeleteAllOutputPalette/

POSTED BY: Kunal Khadke

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.

Posted 4 years 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]]}]]
POSTED BY: Rohit Namjoshi

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

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 -> "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.

DynamicModule[
 {x = 1},
 Column[{
   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 ?

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

POSTED BY: Zbigniew Kabala

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!!!

POSTED BY: Jayanta Phadikar
Posted 4 years ago
POSTED BY: Tom Blanton

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 BY: Jayanta Phadikar

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 ?

POSTED BY: John Burgers

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

POSTED BY: Andreas Rudolph
Posted 4 years ago
POSTED BY: Tom Blanton
Posted 4 years ago

Hi PÃ¥l,

Something like this?

{x = c; PopupMenu[Dynamic[x], {a, b, c, d}], Dynamic[x]}
POSTED BY: Rohit Namjoshi

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

POSTED BY: PÃ¥l Lillevold
Posted 4 years ago
POSTED BY: Doug Beveridge
Posted 4 years ago

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

y = 1 ;

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

Where am I going wrong?

POSTED BY: jeremy kirton
POSTED BY: Jayanta Phadikar

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 BY: Jayanta Phadikar
POSTED BY: Jayanta Phadikar
Posted 4 years 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?

POSTED BY: Gerrie Shults

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

Overlay[{
  background,
  control
  }, Alignment -> {Center, Bottom}]

Thanks.

POSTED BY: John Burgers

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

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

Thanks - I'll check it out

POSTED BY: Charles Glover

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 wolfram-u@wolfram.com and we can try to troubleshoot it.

Posted 4 years 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.

POSTED BY: Raymond Low
Posted 4 years 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

POSTED BY: Rohit Namjoshi

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 BY: Charles Glover

Jayanta, Rohit, Many thanks for your help.

Jorge O

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.

Attachment

Attachments:
Posted 4 years 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"]]
POSTED BY: Rohit Namjoshi
Posted 4 years 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.

POSTED BY: Gerrie Shults
POSTED BY: Jayanta Phadikar
Posted 4 years ago
POSTED BY: Updating Name
Posted 4 years ago

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

POSTED BY: Rohit Namjoshi
Posted 4 years ago
POSTED BY: Rohit Namjoshi
Posted 4 years ago
POSTED BY: Gerrie Shults
Posted 4 years ago

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

Table[ActionMenu[
  "Factorials", {"4!" :> Print[4!], "7!" :> Print[7!], "10!" :> Print[10!]}, 
  Appearance -> a], {a, {None, Automatic, "PopupMenu", "Button"}}]
POSTED BY: Rohit Namjoshi
Posted 4 years ago
POSTED BY: Gerrie Shults
POSTED BY: Rui Alves

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

POSTED BY: James Choi
POSTED BY: Jayanta Phadikar
Posted 4 years 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

POSTED BY: Avery Kramer
POSTED BY: Andreas Rudolph
Posted 4 years ago
POSTED BY: Rohit Namjoshi

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

POSTED BY: Timothy Ewing
Posted 4 years 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.

POSTED BY: Gerrie Shults
Posted 4 years 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 BY: Gerrie Shults
POSTED BY: Timothy Ewing
Posted 4 years ago
POSTED BY: Tom Blanton
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard