Melba23

Fibonacci Clock

27 posts in this topic

#1 ·  Posted (edited)

The Fibonacci clock lets you know the time by changing colours and requiring you do some adding up.

The Fibonacci sequence is the sequence beginning 1, 1 and where each number is the sum of the previous two. Its first five digits are: 1, 1, 2, 3, 5.  These numbers are all you need to express all the numbers from 1 to 12.

1 = 1
1+1 = 2
...
1 + 1 + 2 + 3 + 5 = 12

which means that it is possible to use them to describe the twelve positions on a clock, and therefore tell the time in 5 minute intervals.

Philippe Chrétien of Montreal Canada made such a clock with squares of side length 1, 1, 2, 3, and 5 (the numbers in the Fibonacci sequence) arranged into a "golden rectangle".  The squares lit up in red tell you the hour, and in green give you the minutes (in multiples of five). A square lit up in blue meant it is to be added for both hour and minute. Transparent squares are ignored.

The first example below decodes as follows:

Hours, red 5, red 1 and blue 3 = 5 + 1 + 3 = 9 hours
Minutes: green 2 and blue 3 = 2 + 3 = 5.  5 x 5 = 25 minutes.
So, the time is 9.25.

Clock.thumb.png.924dbde0f35f38d71cb1ad28

And here is a little script to show how you can create a Fibonacci clock of your own - by default it shows the current time (which you can reset at any time using the "Reset" button) or you can test it by entering a time in the combos:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <Date.au3>

$iMargin_X = 10
$iMargin_Y = 10
$iMargin_Inter = 5
$iSize = 50
$iButton_Level = ($iSize * 5) + $iMargin_Inter + 20

$hGUI = GUICreate("Fibonacci Clock", ($iSize * 8) + ($iMargin_X * 2), $iButton_Level + 100)
GUISetBkColor(0xC4C4C4)

$cBack = GUICtrlCreateLabel("", $iMargin_X - $iMargin_Inter, $iMargin_Y - $iMargin_Inter, _
        ($iSize * 8) + ($iMargin_Inter * 2), ($iSize * 5) + $iMargin_Inter)
GUICtrlSetBkColor($cBack, 0x000000)

$cLabel_1A = GUICtrlCreateLabel("", $iMargin_X + ($iSize * 2), $iMargin_Y, $iSize - $iMargin_Inter, $iSize - $iMargin_Inter)
$cLabel_1B = GUICtrlCreateLabel("", $iMargin_X + ($iSize * 2), $iMargin_Y + $iSize, $iSize - $iMargin_Inter, $iSize - $iMargin_Inter)
$cLabel_2 = GUICtrlCreateLabel("", $iMargin_X, $iMargin_Y, ($iSize * 2) - $iMargin_Inter, ($iSize * 2) - $iMargin_Inter)
$cLabel_3 = GUICtrlCreateLabel("", $iMargin_X, $iMargin_Y + ($iSize * 2), ($iSize * 3) - $iMargin_Inter, ($iSize * 3) - $iMargin_Inter)
$cLabel_5 = GUICtrlCreateLabel("", $iMargin_X + ($iSize * 3), $iMargin_Y, $iSize * 5, ($iSize * 5) - $iMargin_Inter)

$cUserSet = GUICtrlCreateButton("Set User Time", $iMargin_X, $iButton_Level, 100, 30)
$cUserHour = GUICtrlCreateCombo("", $iMargin_X + 120, $iButton_Level, 40, 20)
GUICtrlSetData($cUserHour, "00|01|02|03|04|05|06|07|08|09|10|11|12")
$cUserMin = GUICtrlCreateCombo("", $iMargin_X + 160, $iButton_Level, 40, 20)
GUICtrlSetData($cUserMin, "00|05|10|15|20|25|30|35|40|45|50|55")
$cReset = GUICtrlCreateButton("Reset Current Time", $iMargin_X, $iButton_Level + 50, 120, 30)

GUICtrlCreateLabel("Hours:" & @CRLF & @CRLF & "Mins:" & @CRLF & @CRLF & "Both:", 250, $iButton_Level, 150, 80)
GUICtrlCreateLabel("", 300, $iButton_Level, 50, 20)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlCreateLabel("", 300, $iButton_Level + 25, 50, 20)
GUICtrlSetBkColor(-1, 0x00FF00)
GUICtrlCreateLabel("", 300, $iButton_Level + 50, 50, 20)
GUICtrlSetBkColor(-1, 0x0000FF)

GUISetState()

_Reset()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cReset
            _Reset()
        Case $cUserSet
            $iHour = GUICtrlRead($cUserHour)
            $iMin = GUICtrlRead($cUserMin) / 5
            _Set_Clock($iHour, $iMin)
    EndSwitch

WEnd

Func _Reset()

    $sDTG = _NowCalc()
    $iHour = StringRegExpReplace($sDTG, "^.*\s(\d\d):.*", "$1")
    $iHour = (($iHour > 12) ? ($iHour - 12) : ($iHour))
    $iMin = Int(StringRegExpReplace($sDTG, "^.*:(\d\d):.*", "$1") / 5)

    _Set_Clock($iHour, $iMin)

EndFunc   ;==>_Reset

Func _Set_Clock($iH, $iM)

    $iH = Number($iH)
    $iM = Number($iM)

    ;ConsoleWrite("Entry: " & $iH & " - " & $iM & @CRLF)

    GUICtrlSetBkColor($cLabel_1A, 0xC4C4C4)
    GUICtrlSetBkColor($cLabel_1B, 0xC4C4C4)
    GUICtrlSetBkColor($cLabel_2, 0xC4C4C4)
    GUICtrlSetBkColor($cLabel_3, 0xC4C4C4)
    GUICtrlSetBkColor($cLabel_5, 0xC4C4C4)

    $iState_1A = 0
    $iState_1B = 0
    $iState_2 = 0
    $iState_3 = 0
    $iState_5 = 0

    While $iH
        ;ConsoleWrite($iH & @CRLF)
        Switch $iH
            Case 5 To 12
                ;;ConsoleWrite("5-12" & @CRLF)
                If Not $iState_5 Then
                    ;;ConsoleWrite("- 5" & @CRLF)
                    $iH -= 5
                    GUICtrlSetBkColor($cLabel_5, 0XFF0000)
                    $iState_5 = 1
                Else
                    ContinueCase
                EndIf
            Case 3 To 12
                ;;ConsoleWrite("3-12" & @CRLF)
                If Not $iState_3 Then
                    ;;ConsoleWrite("- 3" & @CRLF)
                    $iH -= 3
                    GUICtrlSetBkColor($cLabel_3, 0XFF0000)
                    $iState_3 = 1
                Else
                    ContinueCase
                EndIf
            Case 2 To 12
                ;;ConsoleWrite("2-12" & @CRLF)
                If Not $iState_2 Then
                    ;;ConsoleWrite("- 2" & @CRLF)
                    $iH -= 2
                    GUICtrlSetBkColor($cLabel_2, 0XFF0000)
                    $iState_2 = 1
                Else
                    ContinueCase
                EndIf
            Case Else
                ;;ConsoleWrite("Else" & @CRLF)
                If $iState_1A Then
                    ;;ConsoleWrite("- 1B" & @CRLF)
                    $iH -= 1
                    GUICtrlSetBkColor($cLabel_1B, 0XFF0000)
                    $iState_1B = 1
                Else
                    ;;ConsoleWrite("- 1A" & @CRLF)
                    $iH -= 1
                    GUICtrlSetBkColor($cLabel_1A, 0XFF0000)
                    $iState_1A = 1
                EndIf
        EndSwitch
    WEnd

    While $iM

        Switch $iM
            Case 5 To 12
                $bContinueCase = False
                ;ConsoleWrite("5-12" & @CRLF)
                Switch $iState_5
                    Case 0
                        ;ConsoleWrite("-5:G" & @CRLF)
                        $iM -= 5
                        GUICtrlSetBkColor($cLabel_5, 0X00FF00)
                        $iState_5 = 2
                    Case 1
                        ;ConsoleWrite("-5:B" & @CRLF)
                        $iM -= 5
                        GUICtrlSetBkColor($cLabel_5, 0X0000FF)
                        $iState_5 = 2
                    Case 2
                        $bContinueCase = True
                EndSwitch

                If $bContinueCase Then ContinueCase
            Case 3 To 12
                ;ConsoleWrite("3-12" & @CRLF)
                $bContinueCase = False
                Switch $iState_3
                    Case 0
                        ;ConsoleWrite("-3:G" & @CRLF)
                        $iM -= 3
                        GUICtrlSetBkColor($cLabel_3, 0X00FF00)
                        $iState_3 = 2
                    Case 1
                        ;ConsoleWrite("-3:B" & @CRLF)
                        $iM -= 3
                        GUICtrlSetBkColor($cLabel_3, 0X0000FF)
                        $iState_3 = 2
                    Case 2
                        $bContinueCase = True
                EndSwitch
                If $bContinueCase Then ContinueCase
            Case 2 To 12
                ;ConsoleWrite("2-12" & @CRLF)
                $bContinueCase = False
                Switch $iState_2
                    Case 0
                        ;ConsoleWrite("-2:G" & @CRLF)
                        $iM -= 2
                        GUICtrlSetBkColor($cLabel_2, 0X00FF00)
                        $iState_2 = 2
                    Case 1
                        ;ConsoleWrite("-2:B" & @CRLF)
                        $iM -= 2
                        GUICtrlSetBkColor($cLabel_2, 0X0000FF)
                        $iState_2 = 2
                    Case 2
                        $bContinueCase = True
                EndSwitch
                If $bContinueCase Then ContinueCase
            Case Else
                Switch $iState_1A
                    Case 2
                        $iM -= 1
                        If $iState_1B Then
                            ;ConsoleWrite("-1B:B" & @CRLF)
                            GUICtrlSetBkColor($cLabel_1B, 0X0000FF)
                        Else
                            ;ConsoleWrite("-1B:G" & @CRLF)
                            GUICtrlSetBkColor($cLabel_1B, 0X00FF00)
                        EndIf
                    Case 1
                        ;ConsoleWrite("-1A:B" & @CRLF)
                        $iM -= 1
                        If $iState_1B = 0 Then
                            GUICtrlSetBkColor($cLabel_1B, 0x00FF00)
                            $iState_1B = 1
                        Else
                            GUICtrlSetBkColor($cLabel_1A, 0x0000FF)
                            $iState_1A = 2
                        EndIf
                    Case Else
                        ;ConsoleWrite("-1A:G" & @CRLF)
                        $iM -= 1
                        GUICtrlSetBkColor($cLabel_1A, 0x00FF00)
                        $iState_1A = 1
                EndSwitch
        EndSwitch

    WEnd

EndFunc   ;==>_Set_Clock

If anyone can produce shorter internal code to colour the labels, please do post it - I found that quite a difficult problem to crack and I am certain I do not have an optimal solution.

M23

P.S. The original clock:

 

Edited by Melba23
Added tag by request
3 people like this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites



When setting to 00 / 00 and pushing "Set User Time" it "goes crazy". Upper smallest square becomes red and the below square is flickering in red / grey!

CPU increases to 100% on one core. Probably an endless loop.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

UEZ,

Sorry about that - string/number type mismatch. I have forced the correct datatype in the new code above and it works now (for me at least).

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

There is still an issue. When I change the time and push "Set User Time" (a bunch of times) then the CPU increase to 100% on one core again.

I assume there is no exit in one of the While/Wend loops within _Set_Clock() function on some specific values.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

UEZ,

Why is it always you who has problems with my UDFs?

I cannot reproduce that behaviour when I press the "Set User Time" button repeatedly - it just runs and re-draws the clock (correctly). Can you give me a repeatable selection and button press sequence so I can investigate further.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Sorry, my bad aura. :>

I did random selection, so I cannot give you an exact reproduction. It just happend several times when I stressed your code.

 

Try this: set it to 00 50 and press the "Set User Time" buttom.

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Rather go to bed at this time: no bug! :naughty:


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

UEZ,

Got it - I told you the code was not optimal.

M23

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

All,

And fixed. ContinueCase does NOT do what I rather stupidly expected it to do when it is used inside another, internal Switch structure to the one I wanted to continue. See first post for new code.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Seems to work now. :thumbsup: (not my bad aura)

I'm trying to create a 3D matrix to get rid of the loops within the _Set_Clock function.

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

UEZ,

Great. And my apologies for blaming you - when it was my poor coding that was at fault.

I am looking forward to seeing your version. I did think of using a matrix at one point, but it all got too complicated far too quickly. Although seeing how complicated the loops became it might have been the wrong choice!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Is there a need for both 00 and 12 in the hour combo (as it seems to hold fine without)?  and i uglied it up so the combos match the current time on start:

and your 1s are backwards from the example (clock.png - 5:45): not that i suppose it would matter which 1 is the 'first' 1

GUICtrlSetData($cUserHour, "01|02|03|04|05|06|07|08|09|10|11|12" , @Hour)
$cUserMin = GUICtrlCreateCombo("", $iMargin_X + 160, $iButton_Level, 40, 20)
If @Min <= 2 OR @Min > 57 Then $Min = "00"
If @Min > 2 AND @Min <= 7 Then $Min = "05"
If @Min > 7 AND @Min <= 12 Then $Min = "10"
If @Min > 12 AND @Min <= 17 Then $Min = "15"
If @Min > 17 AND @Min <= 22 Then $Min = "20"
If @Min > 22 AND @Min <= 27 Then $Min = "25"
If @Min > 27 AND @Min <= 32 Then $Min = "30"
If @Min > 32 AND @Min <= 37 Then $Min = "35"
If @Min > 37 AND @Min <= 42 Then $Min = "40"
If @Min > 42 AND @Min <= 47 Then $Min = "45"
If @Min > 47 AND @Min <= 52 Then $Min = "50"
If @Min > 52 AND @Min <= 57 Then $Min = "55"
GUICtrlSetData($cUserMin, "00|05|10|15|20|25|30|35|40|45|50|55" , $Min)

 

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

boththose,

Is there a need for both 00 and 12 in the hour combo

At the moment setting 00 means that no squares are coloured while they are all coloured for 12. As there is no AM/PM selection, I thought I might make at least that distinction.

As the clock is now working for my good friend UEZ, could I also make clear that I have no interest in developing the code further. So please post your own version in this thread if you want to further develop the concept.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

UEZ loves his clocks! ☺

Awesome job Melba! You guys are awesome.

Edited by coffeeturtle

Share this post


Link to post
Share on other sites

All,

OK, I lied - a little update in the first post as I find this a strangely fascinating way of telling the time

Any thoughts out there on how to measure the passing of each minute rather than the current changes on each 5 minute block? Nothing I have thought of so far seems to fit in with the desired Fibonacci zeitgeist.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Well, currently I'm stuck at how to split any number from 2 to 12 to number of Fibonacci sequence.

Examples:

11 = 5 + 3 + 2 + 1

6 = 5 + 1 and not 3 + 2 + 1

7 = 5 + 2 and not 5 + 1 + 1

12 = 5 + 3 + 2 + 1 + 1

etc.

Afterwards it is easy to create the 3D array (matrix) which reflects any possible time.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

This feature also steps up the game.

To add to the challenge, the combinations are picked randomly from all the different ways a number can be displayed. There are, for example, 16 different ways to display 6:30 and you never know which one the clock will use!


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

UEZ,

I decided to use the fewest possible squares - so 6  would always be represented as 5 + 1 and never 3 + 2 + 1.

boththose,

My poor old brain has enough trouble reading the clock using the algorithm I chose - no way do I want to go anywhere near a random choice display!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

Can you check this version whether it works properly?

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <Date.au3>

$iMargin_X = 10
$iMargin_Y = 10
$iMargin_Inter = 5
$iSize = 50
$iButton_Level = ($iSize * 5) + $iMargin_Inter + 20
$bUserSet = False
$iPrevMin = -1
$hGUI = GUICreate("Fibonacci Clock - " & @HOUR & ":" & @MIN & ":" & @SEC, ($iSize * 8) + ($iMargin_X * 2), $iButton_Level + 100)
GUISetBkColor(0xC4C4C4)

$cBack = GUICtrlCreateLabel("", $iMargin_X - $iMargin_Inter, $iMargin_Y - $iMargin_Inter, _
        ($iSize * 8) + ($iMargin_Inter * 2), ($iSize * 5) + $iMargin_Inter)
GUICtrlSetBkColor($cBack, 0x000000)

$cLabel_1A = GUICtrlCreateLabel("1", $iMargin_X + ($iSize * 2), $iMargin_Y, $iSize - $iMargin_Inter, $iSize - $iMargin_Inter)
$cLabel_1B = GUICtrlCreateLabel("1", $iMargin_X + ($iSize * 2), $iMargin_Y + $iSize, $iSize - $iMargin_Inter, $iSize - $iMargin_Inter)
$cLabel_2 = GUICtrlCreateLabel("2", $iMargin_X, $iMargin_Y, ($iSize * 2) - $iMargin_Inter, ($iSize * 2) - $iMargin_Inter)
$cLabel_3 = GUICtrlCreateLabel("3", $iMargin_X, $iMargin_Y + ($iSize * 2), ($iSize * 3) - $iMargin_Inter, ($iSize * 3) - $iMargin_Inter)
$cLabel_5 = GUICtrlCreateLabel("5", $iMargin_X + ($iSize * 3), $iMargin_Y, $iSize * 5, ($iSize * 5) - $iMargin_Inter)

$cUserSet = GUICtrlCreateButton("Set User Time", $iMargin_X, $iButton_Level, 100, 30)
$cUserHour = GUICtrlCreateCombo("", $iMargin_X + 120, $iButton_Level, 40, 20)
GUICtrlSetData($cUserHour, "00|01|02|03|04|05|06|07|08|09|10|11|12")
$cUserMin = GUICtrlCreateCombo("", $iMargin_X + 160, $iButton_Level, 40, 20)
GUICtrlSetData($cUserMin, "00|05|10|15|20|25|30|35|40|45|50|55")
$cReset = GUICtrlCreateButton("Reset Current Time", $iMargin_X, $iButton_Level + 50, 120, 30)

GUICtrlCreateLabel("Hours:" & @CRLF & @CRLF & "Mins:" & @CRLF & @CRLF & "Both:", 250, $iButton_Level, 150, 80)
GUICtrlCreateLabel("", 300, $iButton_Level, 50, 20)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlCreateLabel("", 300, $iButton_Level + 25, 50, 20)
GUICtrlSetBkColor(-1, 0x00FF00)
GUICtrlCreateLabel("", 300, $iButton_Level + 50, 50, 20)
GUICtrlSetBkColor(-1, 0x0000FF)

Global $i, $aFibMatrix[13][12][5], $fTimer = TimerInit()
For $iHr = 0 To 12
    For $iMin = 0 To 11
        $aHr = FibSplit($iHr)
        $aMin = FibSplit($iMin)
        For $i = 0 To 4
            $aFibMatrix[$iHr][$iMin][$i] = 0xC4C4C4
            If $aHr[$i] = $aMin[$i] Then
                If $aHr[$i] Then $aFibMatrix[$iHr][$iMin][$i] = 0x0000FF
            Else
                If $aHr[$i] Then $aFibMatrix[$iHr][$iMin][$i] = 0xFF0000
                If $aMin[$i] Then $aFibMatrix[$iHr][$iMin][$i] = 0x00FF00
            EndIf
        Next
    Next
Next
ConsoleWrite(TimerDiff($fTimer) & @CRLF)
GUISetState()

_Reset()

AdlibRegister("Clock")

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            AdlibUnRegister("Clock")
            Exit
        Case $cReset
            $bUserSet = False
            _Reset()
        Case $cUserSet
            $iHour = GUICtrlRead($cUserHour)
            $iMin = Floor(GUICtrlRead($cUserMin) / 5)
            _Set_Clock($iHour, $iMin)
            $bUserSet = True
    EndSwitch

WEnd

Func Clock()
    WinSetTitle($hGUI, "", "Fibonacci Clock - " & @HOUR & ":" & @MIN & ":" & @SEC)
    If Not $bUserSet Then
        If $iPrevMin <> Int(@MIN / 5) Then
            $iPrevMin = Int(@MIN / 5)
            ConsoleWrite("Clock updated at " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF)
            _Reset()
        EndIf
    EndIf
EndFunc

Func _Reset()

    $sDTG = _NowCalc()
    $iHour = StringRegExpReplace($sDTG, "^.*\s(\d\d):.*", "$1")
    $iHour = (($iHour > 12) ? ($iHour - 12) : ($iHour))
    $iMin = Int(StringRegExpReplace($sDTG, "^.*:(\d\d):.*", "$1") / 5)

    _Set_Clock($iHour, $iMin)

EndFunc   ;==>_Reset

Func _Set_Clock($iH, $iM)

;~  ConsoleWrite("Entry: " & $iH & " - " & $iM & @CRLF)

    GUICtrlSetBkColor($cLabel_1A, $aFibMatrix[$iH][$iM][0])
    GUICtrlSetBkColor($cLabel_1B, $aFibMatrix[$iH][$iM][1])
    GUICtrlSetBkColor($cLabel_2, $aFibMatrix[$iH][$iM][2])
    GUICtrlSetBkColor($cLabel_3, $aFibMatrix[$iH][$iM][3])
    GUICtrlSetBkColor($cLabel_5, $aFibMatrix[$iH][$iM][4])

EndFunc   ;==>_Set_Clock

Func FibSplit($iNumber)
    Local $aFib[5] = [5, 3, 2, 1, 1], $i = 0
    Local $aBits[5]
    While 1
        $iNumber -= $aFib[$i]
        If $iNumber > -1 Then
            $aBits[4 - $i] = 1
        Else
            $aBits[4 - $i] = 0
            $iNumber += $aFib[$i]
        EndIf
        $i += 1
        If $i = 5 Then ExitLoop
    WEnd
    Return $aBits
EndFunc

Thanks.

 

Instead of creating a matrix it is also possible to code 0-12 into bits...

Edited by UEZ
added real time clock display + avoid updating clock every 250 ms

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • golfinhu
      By golfinhu
      Hi, ppl.

      I am developing a GUI with a fix sidebar, based on the style of windows 10 ... I have 3 problems at the moment.
      1 - How do I put the close and minimize buttons on my window? (I want my window not to have the top bar). I tried to draw with gdi plus but I could not.
      2 - My watch flashes when the time is updated. I tried to do with _GDIPlus_GraphicsDrawString but the strings get overlapped.
      3 - I can not leave my transparent buttons to put them in the sidebar (as in this photo below)

      If anyone can help me I would appreciate it very much.
      thanks a lot
       
      GUI.au3
    • Chimp
      By Chimp
      Just for fun
      Idea from here:
      http://codegolf.stackexchange.com/questions/73259/output-the-current-time-in-ascii-art
      Edit:
      Also added an analogue experimental version in post #11
      #include <GUIConstants.au3> HotKeySet("{ESC}", "End") Local $hClock, $sDelim = ";", $aChar, $sScanLines, $aScanLine[6], $aFont[13] = [ _ ' ___ ; / _ \ ; | | | | ; | | | | ; | |_| | ; \___/ ', _ ; 0 ' __ ; /_ | ; | | ; | | ; | | ; |_| ', _ ; 1 ' ___ ; |__ \ ; ) | ; / / ; / /_ ; |____| ', _ ; 2 ' ____ ; |___ \ ; __) | ; |__ < ; ___) | ; |____/ ', _ ; 3 ' _ _ ; | || | ; | || |_ ; |__ _| ; | | ; |_| ', _ ; 4 ' _____ ; | ____| ; | |__ ; |___ \ ; ___) | ; |____/ ', _ ; 5 ' __ ; / / ; / /_ ; | _ \ ; | (_) | ; \___/ ', _ ; 6 ' ______ ; |____ | ; / / ; / / ; / / ; /_/ ', _ ; 7 ' ___ ; / _ \ ; | (_) | ; > _ < ; | (_) | ; \___/ ', _ ; 8 ' ___ ; / _ \ ; | (_) | ; \__, | ; / / ; /_/ ', _ ; 9 ' ; _ ;(_); _ ;(_); ', _ ; : " ; ; __ _ _ __ ;/ _` | ' \;\__,_|_|_|_|; ", _ ; am " ; ; _ __ _ __ ;| '_ \ ' \;| .__/_|_|_|;|_|"]; pm Global $hAsciiClock = GUICreate("Ascii clock", 390, 80, 10, 10, $WS_POPUPWINDOW, BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE, $WS_EX_COMPOSITED)) $hClock = GUICtrlCreateLabel("", 0, 0, 390, 80, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 7, 0, 0, "Courier new") GUISetState() While 1 $sTime = StringFormat("%02s", @HOUR - (12 * (@HOUR > 12))) & "A" & @MIN & "A" & @SEC & Hex(11 + Number(@HOUR > 12), 1) For $x = 1 To StringLen($sTime) $achar = StringSplit($aFont[Dec(StringMid($sTime, $x, 1))], $sDelim, 3) For $i = 0 To 5 If $x = StringLen($sTime) Then ; last char (am or pm) $aScanLine[$i] = StringFormat('%-65s', $aScanLine[$i]) & $achar[$i] Else $aScanLine[$i] &= $achar[$i] EndIf Next Next For $i = 0 To 5 $sScanLines &= $aScanLine[$i] & @CRLF $aScanLine[$i] = "" Next GUICtrlSetData($hClock, $sScanLines) $sScanLines = "" Sleep(1000) WEnd Func End() If WinActive("[ACTIVE]") = $hAsciiClock Then Exit EndFunc ;==>End  
    • UEZ
      By UEZ
      Here my contribution to the clock fever - nothing special rather a fast hack:
      Download:  AutoIt Eye Clock v1.3.1 build 2015-06-28.7z
       
      Left eye = hour, right eye = minutes, pupil light = seconds

       
       
       
       
       


       
      You can rename the compiled script to *.scr to behave as an screensaver. Furthermore you can copy the *.scr to System32 (x86 system) or SysWOW64 (x64 system) and configure it as a screensaver incl. preview.
       
      Original clock: http://www.suck.uk.com/products/eyeclock/
       
      Have fun.
    • Chimp
      By Chimp
      ....from the  serie "strange clocks":
      see here for infos on how to read this clock
      ; Berlin-Uhr HotKeySet("{Esc}", "End") Global $aColors[3] = ["0x757575", "0xFFCC00", "0xFF0033"] ; [off][yellow][red] Local $iSec = 0, $iMin = 0 Global $hGui = GUICreate(' Berlin-Uhr', 275, 240) ; ($nrPerLine, $ctrlWidth, $ctrlHeight, $xPanelPos, $yPanelPos, $xSpace) Local $aGuiSecsX2 = _GuiPanel(01, 55, 35, 115, 010, 5) ; Seconds blink Local $aGuiHourX5 = _GuiPanel(04, 55, 35, 025, 055, 5) ; Hours * 5 Local $aGuiHourX1 = _GuiPanel(04, 55, 35, 025, 100, 5) ; Hours Local $aGuiMinsX5 = _GuiPanel(11, 16, 35, 025, 145, 6) ; Mins * 5 Local $aGuiMinsX1 = _GuiPanel(04, 55, 35, 025, 190, 5) ; Mins GUISetBkColor("0x9A9A9A", $hGui) GUISetState(@SW_SHOW) Do If @SEC <> $iSec Then ; when the second changes do what following $iSec = @SEC GUICtrlSetBkColor($aGuiSecsX2[1], $aColors[@SEC / 2 = Int(@SEC / 2)]) ; second blink If @MIN <> $iMin Then $iMin = @MIN For $i = 1 To 11 If $i < 5 Then GUICtrlSetBkColor($aGuiHourX5[$i], $aColors[2 * (Int(@HOUR / 5) >= $i)]) GUICtrlSetBkColor($aGuiHourX1[$i], $aColors[2 * (Mod(@HOUR, 5) >= $i)]) GUICtrlSetBkColor($aGuiMinsX1[$i], $aColors[Mod(@MIN, 5) >= $i]) EndIf GUICtrlSetBkColor($aGuiMinsX5[$i], $aColors[(Int(@MIN / 5) >= $i) * (1 + ($i = 3 Or $i = 6 Or $i = 9))]) Next EndIf EndIf Until GUIGetMsg() = -3 ; $GUI_EVENT_CLOSE End() Func _GuiPanel($nrPerLine, $ctrlWidth, $ctrlHeight, $xPanelPos, $yPanelPos, $xSpace = 1) ; create the controls Local $aGuiGridCtrls[$nrPerLine + 1] For $i = 1 To $nrPerLine $left = $xPanelPos + ((($ctrlWidth + $xSpace) * ($i - 1)) - $xSpace) $aGuiGridCtrls[$i] = GUICtrlCreateInput("", $left, $yPanelPos, $ctrlWidth, $ctrlHeight, 0x0800) ; 0x0800 = $ES_READONLY GUICtrlSetBkColor(-1, $aColors[0]) Next Return $aGuiGridCtrls EndFunc ;==>_GuiPanel Func End() If WinActive($hGui) Then GUIDelete($hGui) Exit EndIf EndFunc ;==>End  
    • BrewManNH
      By BrewManNH
      Following along with the odd clock theme that seems to be popular lately, I have come up with a BCD clock to add to the collection. It's a 24 hour clock, you can modify it to a 12 hour clock, but it's not as interesting that way.
      This clock can be changed to display milliseconds by changing one variable at the start of the Main function, there are comments describing that. In my opinion I wouldn't have it display the mseconds because they change too fast to keep track of, it looks terrible, and flickers BADLY.
      The way the clock is set up currently, it displays one icon for the light being "off" and another for it being "on". You can use whatever icons for these that you'd like instead of the ones in the zip file. Change the variables in the Global declaration at the start of the script to whatever you'd like. Another variation that you can use is to set the "off" icon to a blank file name and then it will only turn on the lights that are supposed to be on, and there will be empty spaces for the off icons.
      If nothing else, at least you'll learn binary and/or BCD numbers.
      Updated: Corrected the issue with the seconds for the number 7.
       
      BCD Clock.zip