Message Boards Message Boards

GROUPS:

Showing countdown output in fullscreen?

Posted 1 month ago
658 Views
|
10 Replies
|
5 Total Likes
|

Hi All,

I'm a complete novice with no programming knowledge and need some help. I'm trying to create a countdown timer to give to my partner, but having issues as no clue what I'm doing. I have a Raspberry Pi with 5" touchscreen, and some kind soul has provided me with the following code using Mathematica.

(* Countdown to 8AM Christmas Morning, for example. *)
Dynamic[ DateDifference[
Now, {2021, 12, 25, 8}, {"Days","Hours","Minutes"} ],
UpdateInterval -> 0.5 ] // Print

The output is only printing the countdown below the above code snippet, where ideally I would like to get timer to display fullscreen using the full real estate the LCD can provide (ideally with a picture behind it if possible).

I've been searching for any information online but I'm either searching the wrong terms or looking in the wrong places. So wondering if anyone here can help.

10 Replies

Steven,

this is a nice idea! Here comes a simple approach as a first guess. (Use F12 to leave full screen mode.)

textSize = 140;       (* to be adjusted *)
imageSize = Full;  (* to be adjusted *)
img = 
 Import["https://images.freeimages.com/images/large-previews/13d/xmas-decoration-1360454.jpg", ImageSize -> imageSize];  
CreateDocument[
  Overlay[{img, 
    Style[Dynamic[
      UnitConvert[
       Round@DateDifference[Now, {2021, 12, 25, 8}, {"Seconds"}], 
       MixedUnit[{"Days", "Hours", "Minutes", "Seconds"}]], 
      UpdateInterval -> 1], textSize]}, Alignment -> Center],
  WindowSize -> Full, WindowTitle -> "Time left until Xmas 2021"];

enter image description here

Posted 1 month ago

Thanks for that,

I've tried the code you have suggested above, but I think I've done something wrong. It's running but the background image is overlaid with a snippet of the code.

Code: https://imgur.com/bllZPu3 Overlay: https://imgur.com/Rs3segv

I've looked over what I've put in and apart from adjusting the textSize and the time, I can't see anything wrong.

Cheers

Attachment

Attachment

Henrik's code worked fine on my PC. In your case, looks like it didn't work and there is an error message in the output. Can you click on the top right orange box? (in your first image)

Also which version of Mathematica are you running on your Raspberry Pi?

Posted 1 month ago

Clicking on the little orange "+" I get the following messages.

  • Thread: Objects of unequal length in (2021, 12, 25, 6) {Seconds} Cannot be combined
  • DateDifference: Expression {Seconds} (2021, 12, 25,6) cannot be interpreted as a date specification.

Version Wise - It says I'm running "Mathematica 12 for Raspberry Pi, Version 12.2.0.0"

Posted 1 month ago

Found the issue, there was a missing "," its working now

Posted 1 month ago

Updated so it's using an image from the Pi itself to see if I could that got rid of the white boarder on the right, but still doesn't fill the screen.

Also looking to change the colour to something bolder. For this would i just need to add the code Style[1/Sqrt[2], FontColor -> Red]

into the existing code?

Steven,

my first guess was that your system does not know MixedUnit - so I tried to improve the code without this command. But anyway. Here is a somewhat nicer version:

textSize = 140;
textColor = Red;
imageSize = Full; img = 
 Import["https://images.freeimages.com/images/large-previews/13d/xmas-decoration-1360454.jpg", ImageSize -> imageSize];
CreateDocument[
  Dynamic@Overlay[{img,
     secs = 
      Round@QuantityMagnitude[
        DateDifference[Now, {2021, 12, 25, 8}, {"Seconds"}]]; 
     days = IntegerPart[secs/86400]; secs -= days 86400; 
     hours = IntegerPart[secs/3600];
     secs -= hours 3600;
     mins = IntegerPart[secs/60];
     secs -= mins 60;
     Style[
      TextGrid[{{days, "d"}, {hours, "h"}, {mins, "m"}, {secs, "s"}}, 
       Frame -> None], textColor, textSize]},
    Alignment -> Center], WindowSize -> Full, 
  WindowTitle -> "Time left until Xmas 2021"];

enter image description here

Nice bit of code, and thanks for all the code that you put up here. (This one I actually can understand.)

For the WindowTitle, does that show up for you in Full Screen Mode? I does not show up for me on Rasp Pi and 12.1 or 12.2

Docked cells do show in Full Screen Mode, as do cell brackets, both scroll bars and even Ruler and Toolbar. Is this behavior for "Full Screen" the same as other platforms, or am I doing something wrong?

Hi Warren,

I do observe exactly the same behavior you are describing. My system:

12.3.1 for Linux x86 (64-bit) (June 24, 2021)

So, you are not doing anything wrong! And I do not know how to expand the image to fill the entire screen, unfortunately. Anyone?

Regards -- Henrik

Posted 1 month ago

Thank you, that is much clearer. Just wondering if it's possible to get rid of the white border, and fill the screen?

Think for what my partner wants it will work, but I know it will trigger her OCD lol.

Again can't thank you enough.

Attachment

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

Group Abstract Group Abstract