definite-d / Themera

PySimpleGUI theme code generator.
GNU Lesser General Public License v3.0
28 stars 8 forks source link

Updates on Making Themera better. #2

Closed PySimpleGUI closed 1 year ago

PySimpleGUI commented 4 years ago

I have 2 very long issues that hold ALL of my images. I don't upload them to files for readme's. Instead I copy and paste or drag and drop into my "screenshots" issue.

Like this shot is a simple "screen copy" that's on my clipboard. I pasted here: image

You will notice when you're editing the issue that when you drag and drop or copy and paste, a line like this is added:

![image](https://user-images.githubusercontent.com/46163555/70379106-a22b7580-18f6-11ea-9756-44d0f9528bcd.png)

You can then take that URL with the .jpg or .png file and use it directly in your readme.

Done... no fuss, no uploading stuff to github folders. The Issue can even be closed where people don't see it. Like this one in my GitHub:

https://github.com/PySimpleGUI/PySimpleGUI/issues/1897

Doing this is using GitHub as an image file server. I use it for Reddit posts. All kinds of shit. It's easier than Imagr and other services. Drop, drop, copy the link it makes and paste into your Reddit post and off you go.

This is how I make stuff like readme's, cookbooks, etc, with great speed.

definite-d commented 4 years ago

Thanks a lot for the tip! I'll do that.

definite-d commented 4 years ago

I'll probably close this issue now (as issue #1 already has some screenshots I could use), but I thought I'd ask you first; what do you think of LookyFeely? Not trying to rush you into trying it out (managing PySimpleGUI with hundreds of users "throwing" issue logs at you must be very time consuming, and your life likely doesn't revolve around lines of code alone), but If you have tried it out, please let me know how it feels to use.

--Side Note------------------------------->> With the latest commit to the main script, I added two lines of code that would have been the solution to an Issue I thought of opening on PySimpleGUI. The title would have been, "[ Enhancement/Bug ] Default LookAndFeel Themes' Loader Bar Colors Need to be Unique to Each Theme,". The two lines of code simply change the sg.LOOK_AND_FEEL_TABLE[random_theme]['PROGRESS'] parameter to equal a tuple of the Text and Input colors:

if sg.LOOK_AND_FEEL_TABLE[random_theme]['PROGRESS'] == sg.DEFAULT_PROGRESS_BAR_COLOR: sg.LOOK_AND_FEEL_TABLE[random_theme]['PROGRESS'] = (sg.LOOK_AND_FEEL_TABLE[random_theme]['TEXT'], sg.LOOK_AND_FEEL_TABLE[random_theme]['INPUT'])

definite-d commented 4 years ago

My Markdown skills suck.

PySimpleGUI commented 4 years ago

I'll probably close this issue now (as issue #1 already has some screenshots I could use), but I thought I'd ask you first; what do you think of LookyFeely? Not trying to rush you into trying it out (managing PySimpleGUI with hundreds of users "throwing" issue logs at you must be very time consuming, and your life likely doesn't revolve around lines of code alone), but If you have tried it out, please let me know how it feels to use.

I spent some time making themes with your program. It's awesome to see you want more colors! It's a good thing to see as most seem to pass this over way too often. It's why I added the "nag print" to the code recently for gray windows.

It's difficult to get the flow right for user interfaces. Your theme maker does a good job of creating the code, packaging up the colors so they can be used by users. It's the color choosing part that's slow. Because you have no control over the "Color Chooser Dialog" that tkinter makes, it ends up in awkward positions. For me, on a huge monitor, it meant mousing a foot and a half over every time I went to choose a color.

One way around this is to use your own color chooser. I recently released a simple one as a Demo Program. It's not all that bad actually. You might want to consider swapping it in and seeing how it feels.

The user interfaces that are good are created through an iterative process, even more-so than coding being iterative. For me I have to try a lot of stuff that doesn't work to get to the one that does.

You've got an interesting opportunity to make a unique user interface for making themes. Consider doing something out of the box. How about putting a slider next to each color that will traverse a list of colors and update a patch next to the line as you slide the slider. This will enable the user to quickly enter information.

For me, that was the name of the game... speed. It's why I downloaded all those pre-made palettes. They gave me a quick way to get matching colors, bypassing the need to manually dial-in colors. It meant losing a lot of the controls that you're providing. I presented myself with a much limited set of choices.

Here's what I see now when I'm making themes.... combinations of stuff based on 4 colors...

image

I can make some tweaks, but not many.

I like that you're building something.... anything.... that's the point in all this. I've written and re-written and re-written many programs over the decades. It's by doing that you improve.

Take another try at it as a version 2. Do out of the box stuff. Consider using some color formulas you find online to automatically make other colors based on the user entering an initial color or two.

The way I made my light and dark themes was that I searched and found a function that will sort colors by brightness. Then I was able to sort my 4 colors from dark to light. I didn't know and don't know how that function works, I just knew I wanted something that would sort colors by brightness.

Mix stuff up. Try completely new things for Version 2. Look at PySimpleGUI, it's on version 4. The code made today using it looks NOTHING like the code for versions 1 and 2. None of the names are the same. There was no "Window" object until version 3 I think.

You've got plenty here to feel good about accomplishing. You did the whole project, beginning to end, AND learned how to share it with the world. You're on your way :-)

Oh, and my markdown REALLY sucks.

definite-d commented 4 years ago

Sorry about the days-old reply here. I read and re-read that review of LookyFeely, and it feels great for the creator of PySimpleGUI to provide feedback.

As for this part,

How about putting a slider next to each color that will traverse a list of colors and update a patch next to the line as you slide the slider. This will enable the user to quickly enter information.

I'm not sure how I can accomplish that, but I'll try and keep you posted.

Take another try at it as a version 2. Do out of the box stuff. Consider using some color formulas you find online to automatically make other colors based on the user entering an initial color or two.

This should be very possible to accomplish, but won't that put ThemeMaker our of business ;). Anyway, I'm guessing this could work:

I also just got this idea: Two tickboxes could be added to the bottom of the main window that when ticked, will add code for an auto-generated dark or light mode.

Well, I guess this project isn't open source for nothing. I look forward to more ideas.

Development of LookyFeely just got a whole lot more exciting.

definite-d commented 4 years ago

Sorry, I had to change the name of the issue. Should a new issue be opened?

PySimpleGUI commented 4 years ago

It's your repo to manage so I wouldn't worry about renaming items to better fit how you see them. No need to get caught up in process at this point.

I tossed out a few ideas. You don't need to make too much of them as they're just opinions. What do I know, I'm making this stuff as I go along. I've never written a GUI program in my life so it's all new for me just like this is new for you.

Feel free to put out of business anything I or anyone else has written. You're welcome to take and use the color definition file that Israel gave to me where I got the 1,700 palettes. Take the algorithms I found too if they're helpful. It's all meant to be built upon. Historically that's how everything in computers has been done. It all builds or gets replaced or wrapped or .... Rarely do things stick around for decades unchanged.

The reason I bought up sliders is that I've not tried it and I've not seen anyone else try it. It was just an idea that popped into my head of "something different". I have lots of ideas.... I've learned over the years that many of them are not good, so take it as just an idea and nothing more.

I'm urging you to use the Elements, all of them, to solve a problem. Maybe a Combo box would be helpful for something. Or checkboxes as you mentioned. I used radio buttons to choose a few options. The point in this is that there is a selection of GUI Elements for us to choose from and assemble in ways not done before..... or maybe they have.

I get ideas, and code, from other people too. I ask for ideas from people often as well. It's not like I've got a secret formula for what I'm doing. I read a lot of code and am thus taught how to use PySimpleGUI by the users. One user has been on fire recently, cranking out games that are crazy good. When I saw and played them I didn't believe they were written with PySimpleGUI.

You'll find a link to his Minesweeper and the code itself to a new solitaire game as part of this issue: https://github.com/PySimpleGUI/PySimpleGUI/issues/2356

The solitaire game is crazy as there are dealing animations and other stuff I wouldn't think possible. But yet, here is a guy with English as a second language that is greatly out-coding anything I've made. He's teaching me techniques and concepts I hadn't thought of. He also extended the PySimpleGUI library and caused me to create the new bind capability, enabling everyone to get more tkinter events to be returned through the window.read() call. It's another example of how a user's code influenced the development path of PySimpleGUI.

What I was trying to say before is that the key to programming is to write code and read code. And to do as much of that as you can. It's a craft, just like watch repair is a craft. Or playing a musical instrument. The way you improve in crafts is by practice. It really is a matter of time and how much over the long term time is invested. Through iteration things improve, new ideas get added or discovered.

You're doing great! I'm glad you're feeling excited about the project. It's passion that drives projects like PySimpleGUI. Otherwise we're all just turning the crank, being a cog in a some computing machine.

definite-d commented 4 years ago

Thanks for the advice! I'm probably going to follow that @jason990420 guy; he's challenging my view of how most games are made (in a game engine like Godot), and I love it (both Godot and his challenge of my philosophy. You can check out Godot here: https://godotengine.org/). Turns out, this...:

I'm not sure how I can accomplish that, but I'll try and keep you posted. ...is actually going to be this...: I can do that for sure.

...thanks to this module: https://pypi.org/project/colour/

So, don't toss all those creative ideas out the window ;).

I've already begun coding additional features discussed above. If the UI gets messy (and it might), I'll use Tabs to sort things out!

By the way, I tried out the Tab element in one of my projects (you'll likely hear about it soon ;) !) other than LookyFeely, and (please correct me if I'm wrong) I noted that the default colors were not dependent on the current LookAndFeel picked. I had to apply the same logic from modding the Progress Bar colors. I totally get the want for a green progress bar everywhere (Windows users, lemme hear ya scream!), but for tabs, how about adding LookAndFeel table entries for its colors or basing it off other colors by default as I did? That would really make Tabs flow with the LookAndFeel vibe.

PySimpleGUI commented 4 years ago

I have modified the code so that both the tabs and the progress bars use the look and feel settings.

4.9.0 added color for tabs

4.10.0 added color for progress bars

Now pretty much everything is being colored using the Look and Feel settings.

PySimpleGUI commented 4 years ago

For color processing, I looked at several packages, but ended up instead going out and finding the code for the specific tasks I wanted to do.

These are the color functions I ended up using in the Theme Maker code.

The most important of them is the rgb_to_hsl which enabled me to sort the colors by brightness. It's how I was able to generate "Dark" and "Light" themes with confidence as I knew when I was working with a dark color and when with a light.

def rgb_to_hsl(r, g, b):
    r = float(r)
    g = float(g)
    b = float(b)
    high = max(r, g, b)
    low = min(r, g, b)
    h, s, v = ((high + low) / 2,)*3
    if high == low:
        h = s = 0.0
    else:
        d = high - low
        l = (high + low) / 2
        s = d / (2 - high - low) if l > 0.5 else d / (high + low)
        h = {
            r: (g - b) / d + (6 if g < b else 0),
            g: (b - r) / d + 2,
            b: (r - g) / d + 4,
        }[high]
        h /= 6
    return h, s, v

def hex_to_rgb(hex):
    hex = hex.lstrip('#')
    hlen = len(hex)
    return tuple(int(hex[i:i + hlen // 3], 16) for i in range(0, hlen, hlen // 3))

def sorted_tuple(tup, position):
    tup.sort(key=lambda x: x[position])
    return tup
PySimpleGUI commented 4 years ago

By the way, I tried out the Tab element in one of my projects (you'll likely hear about it soon ;) !) other than LookyFeely, and (please correct me if I'm wrong) I noted that the default colors were not dependent on the current LookAndFeel picked.

Make sure to pick up the latest release. They've been coming out fast recently. I always post in the Announcement Issue when one gets posted to PyPI.

Because I wanted to get some of these features out quickly, I went ahead and pushed them out the door and up to PyPI.

In the past week there have been 4 releases.

4.8.0 PySimpleGUI 4-Dec-2019

Multicolored multiline text! Often asked for feature going way back ttk Buttons can have images Print in color!

4.9.0 PySimpleGUI 7-Dec-2019

The "Finally Nailed Tabs" release

4.10.0 PySimpleGUI 9-Dec-2019

"Oh crap the debugger is broken!" + "Pretty Progress Bars" release

4.11.0 PySimpleGUI 10-Dec-2019

The Element & Window bindings release

definite-d commented 4 years ago

That is super cool. I'll update today. Thanks for adding the Tab color LookAndFeel spec. And the CURRENT_LOOK_AND_FEEL value is a lifesaver too. Now I don't have to explicitly specify the theme in a variable before passing it to the ChangeLookAndFeel function to allow for referencing the name of the theme. Fantastic update overall. Fantastic.

definite-d commented 4 years ago

Updated. Still on the job, but I may release the new v2.0.0 by next week. I'm currently trying out different ways to accomplish the general tasks in Python. That means a lot of testing and re-coding.

And in case you noticed it, FastB64 isn't the project I was referring to earlier. It's just a project I made in the hope that having the icon embedded into the script would be less stressful.

definite-d commented 4 years ago

Thanks for the functions for color manipulation. I'm going to add them now. I've integrated tabs into the design to avoid having a window that stretches longer than a hermit's shopping list, and also to allow for more options and space to implement GUI ideas.

To compact things further, is there an element that provides a sort of scrollable container function for other elements?

PySimpleGUI commented 4 years ago

Column is one of the "Container" elements that holds other elements so that you can scroll them. It's well documented and used extensively in the demo programs.

definite-d commented 4 years ago

Will do. I used to think columns were only for cool alignment effects. Thanks for the tip.

Another thing; have you got any idea how I can use Base64 encoded images with either SetOptions() or SetGlobalIcon()? I tried it with the icon parameter of a window and it worked as expected, but the other two don't work.

PySimpleGUI commented 4 years ago

Not just for aligning. They are an all-purpose containing. The parameters specific address use of scrollbars. At one time it was how tables were scrolled.

definite-d commented 4 years ago

Hello again, @PySimpleGUI. During development, I thought of something, and decided I'd ask you about it. It's a bit off topic (it's about licensing), but it's important to me (and I probably should've put it in an issue on the PySimpleGUI repository).

I know PSG-LookyFeely operates (and will always operate) under the same license as PySimpleGUI, but PySimpleGUI is the only GUI framework in Python I currently use, and I'm afraid not all projects I develop can be open source or under the LGPL (so I can't just slap on an LGPL and not care so much about violating PySimpleGUI's LGPL requirements because we run under the exact same terms).

In the process of putting up my latest project (FastB64, still developed with PySimpleGUI, under LGPL3), I had to pick and review a license for it, and went with the LGPL3. Ironically, that was my first time of reading the very license that I'd picked a few times. In it, I saw a few things I could understand, like the definition of 'Combined Work', and enabling the end-user to swap out the 'Linked Library' with a version of their choice. Now, here's the puzzling scenario:

There seems to be no way to swap out PySimpleGUI with a version that the user wants, because it appears PySimpleGUI doesn't exist within that app bundle. Is that [app bundle] still legal? Am I allowed to sell such an app? Can I license it however I please?

(Note: the term 'app' used here denotes the generic abbreviation for 'application', not a Mac bundle. I'm sure you already knew that anyway. The app in question is the FastB64 project)

Thanks.

Edit: I'm putting up everything about the FastB64 (including the PyInstaller build and dist folders.)

PySimpleGUI commented 4 years ago

I can't help you with legal / licensing questions except to refer you to the license file.

If you have applications that this license won't apply to, then other licensing arrangements may be possible. But there will need to be a new commercial license drawn up for you.

definite-d commented 4 years ago

Hello again, @PySimpleGUI! Today, I battled with accomplishing the Mono option that's made available when a color isn't selected. Still on it, but its coming along fine. I almost forgot about the 'slider' idea, but I found no suitable place to integrate it. So I thought, how about having a tab under the Specifier tab (where the color pickers and stuff are now), and call it 'Quick Mode', while the previous contents of the Specifier tab would go under a tab called 'Detailed Mode'. It's likely that I'll still have to use the colored module for the slider values, though. I intend to use the colored module's ability to take in two color values and spit out a range of colors in transition between them.

To spice things up a bit, is it possible to have an image/normal icon/base64 icon beside the name of a tab? Something like the Python logo beside the name of any Python script open in PyCharm for example (if you use PyCharm). It's okay if the answer is no; I just thought of a workaround: the emoji module. Besides, it's just a miscellaneous addition.

PySimpleGUI commented 4 years ago

The slider idea was to have a slider available as a way to choose colors. I envisioned any place that you can enter #RRGGBB manually, you can do it with one or three sliders. If a single slider, then it could be located right next to the input element. If multiple then maybe use a popup. I thought it would be a quick and easy way to "dial in" a color instead of manually typing it. If a single slider it would go from 000000 to FFFFFFF. If 3 sliders then each would be 0 to FF. I dunno if it's a good idea or not. I was simply trying to find alternative ways for users to specify information in a way other than the keyboard.

Icons on stuff in general

You're welcomed to open an enhancement to add an icon to a tab. That's more likely to happen on PySimpleGUIQt would be my guess. I don't know if it's possible in tkinter. If it is possible, then you may be able to extend PySimpleGUI yourself and add the code in your user code.

Other places people have asked for icons are in the right click menu for System Tray icons, the menu in button and menu-bar menus.

Tree elements already support icons. Buttons do as well.

You've already come up with one good idea which is to use UNICODE characters in the string itself. This will be the way to achieve it immediately.

Another approach is to not use tabs at all but instead use buttons and simulate your own tabs. It's quite an advanced kind of feature to do, but I've seen it done. You would create a bunch of Column Elements that you hide and then you make them appear when a corresponding button is clicked.

definite-d commented 4 years ago

Whoa, quick reply. I guess I hit the timing just right. We're probably in different timezones.

Anyway, ...bingo!!!! I literally just had this idea while typing. What if, the sliders for color selection (as you've aptly suggested) were to act as the color picker window? Simply throw in a text-input controlled by the sliders and a button for confirmation. And I could try to make the button color update itself to be the same as the color in the text box (via the timeout parameter of the window.

But... if it doesn't work as expected, I might have to stick with the 'Demo Program' color picker.

I meant to also say: The Unicode thing could suffice for this project, but if you give the go-ahead, I could experiment with creating a new tab compund element. It could be called 'Combo Tab'.

PySimpleGUI commented 4 years ago

I mentioned the tab as a button because I saw it done. It was in one of the most complex PySimpleGUI programs I've ever seen. This project: https://github.com/mrmin123/kcauto

The GUI is in 20+ files https://github.com/mrmin123/kcauto/tree/390-2019-fall-event/kcauto/gui

And it's not easy code to read either. TONS of it. It took me a while to get it to run but I eventually did. I think you'll find they made compound elements in a number of places.

I wouldn't think of this kind of tabs using buttons implementation as a compound element. It's an entire subsystem of it's own. You have to manage multiple rows of buttons that display and hide multiple columns under it. If you try it, make sure the columns are all on the same row.

I dunno, maybe it can be a compound element of sorts. Normally compound elements you can place directly into your layouts. This is a different beast. It's makes buttons that are several rows away from a series of columns that each have layouts. Your function would need to return an entire layout that the user would then add into their layout. It's all possible to do in a semi-portable way so that it'll work on Qt and tkinter. Hard to tell how different they will look.

If you want an icon next to text on a button, you'll need some special code to do that too. I would recommend simply making custom button graphics rather than go through the trouble of overriding PySimpleGUI's text placement on a button and figuring out how to put an image on a button with the text.

Just about anything's possible with enough work. The recent games are a testament to that as well as the above project. Neither programmer ever contacted me. I found their work after it was completed. They never asked a single question. They simply dug in and learned PySimpleGUI inside and out. Ran a TON of experiments, learned tkinter so that they could extend it, etc. It no doubt took them time.

I think you're getting the idea now on the use of slider(s) for color selection. Yes, replacing the color selector with a slider either built into the main window or popups up above the main window. A few programs have been written recently that use a custom popup window to take in some kind of input and put the input into the main window. The most recent was a PIN entry thing that's detailed in an Issue.

Anyway, keep digging... you're doing great stuff.

definite-d commented 4 years ago

That's a lot; >20 files for a GUI. Not to mention really complex. If not given enough time, I'd probably make some dumb errors (like forgetting to close an element's function call with ')' ).

I was honestly thinking of having 2 rows: one for the tab-button-headers and another for Column elements of corresponding number, then allowing the user pick which tab should be displayed first (or probably ine that myself) and taking in layout lists for the Columns. Didn't think it would entail such. Oh well, it was just a thought.

I've got a small observation about popups: It seems there's no way to set the element justification for their elements. I understand that that feature is available only on the Tkinter port, but that's what I'm using for LookyFeely. And it seems to me that popups are little prebuilt windows. That's one reason why I refrained from using so many popups in FastB64. In one project, I even defined my own popups based on the Window element, just for that reason.

PySimpleGUI commented 4 years ago

It's too extreme for me. I didn't enjoy reading through their stuff. I got quickly lost. I like SIMPLE stuff, obviously.

By the way, some people are building the ability to change color scheme into their code. This new one, PyIDM is using them and saving the user's choice in the system settings. He's new to Python too evidently, but made quite a complex thing.

Popups are indeed little prebuilt windows. I call Window just like everyone else. Use Elements to make a layout. It's just a bunch of functions meant to make repetitive stuff easier and to make things really convenient for beginners. You can get a lot done with Popups.

Glad to hear you're making your own. Custom little windows are cool.

I'll leave you with this interesting little popup window thing. It a program that a guy wrote that I helped him get working right.

It was part of this issue https://github.com/PySimpleGUI/PySimpleGUI/issues/2259

It's a little popup built-into the main event loop. It would better have been a popup window broken out as a function just to modularize a little.

import PySimpleGUI as sg
from PySimpleGUI import InputCombo, Combo, Multiline, ML, \
    MLine, Checkbox, CB, Check, \
    Button, B, Btn, ButtonMenu, \
    Canvas, Column, Col, Combo, \
    Frame, Graph, Image, InputText, \
    Input, In, Listbox, LBox, Menu, \
    Multiline, ML, MLine, OptionMenu, \
    Output, Pane, ProgressBar, Radio, \
    Slider, Spin, StatusBar, Tab, \
    TabGroup, Table, Text, Txt, T, \
    Tree, TreeData, VerticalSeparator, Window, Sizer

print(sg.version, sg)

sg.change_look_and_feel('GreenTan')

col1 = Column([
    [Frame('Information:', [[Column([[Text('UNO:'), Input(key='-UNO-', size=(16, 1), tooltip='Insert your NO'), \
                                      Button('⌨', key='-KEYBOARD-', tooltip='Activate keyboard')],
                                     [Text('S/N:'), Input(key='-SN-', size=(16, 1), tooltip='Insert serial number of the product')],
                                     ], size=(240, 130), pad=(0, 0))]])],
], pad=(0, 0))

layout = [
    [Text('KBTest', size=(41, 1), key='text', justification='center', font=('Helvetica', 24), relief=sg.RELIEF_RIDGE)],
    [col1],
]

output = Window('Guided Test', layout, size=(400, 240)).Finalize()

keypad_active = False

while True:
    event, values = output.read()
    print(event, values)
    if event is None:
        break

    if not keypad_active and event == '-KEYBOARD-':
        output_elem = output.find_element_with_focus()
        output.hide()
        keypad_active = True

        keypad_layout = [
            [sg.Input('', size=(10, 1), key='input')],
            [sg.Button('1'), sg.Button('2'), sg.Button('3'), sg.Button('4')],
            [sg.Button('5'), sg.Button('6'), sg.Button('7'), sg.Button('8')],
            [sg.Button('9'), sg.Button('0'), sg.Button('⏎', key='Submit'), sg.Button('Clear')],
            [sg.Text('', size=(15, 1), font=('Helvetica', 18),
                     text_color='red', key='out')],
        ]

        keypad = Window('Keypad', keypad_layout,
                        default_button_element_size=(5, 2),
                        auto_size_buttons=False,
                        grab_anywhere=False)

        # Loop forever reading the form's values, updating the Input field
        keys_entered = ''
        while True:
            event, values = keypad.read()  # read the form
            if event is None:  # if the X button clicked, just exit
                break
            if event == 'Clear':  # clear keys if clear button
                keys_entered = ''
            elif event in '1234567890':
                keys_entered = values['input']  # get what's been entered so far
                keys_entered += event  # add the new digit
            elif event == 'Submit':
                keys_entered = values['input']
                output_elem.update(keys_entered)  # output the final string
                break
            # change the form to reflect current key string
            keypad['input'].update(keys_entered)
        keypad.close()
        keypad_active = False
        output.un_hide()
definite-d commented 4 years ago

Will do. Will do. Perhaps I'll open another repo where I can put up all my little enhancement scripts for PySimpleGUI.

This really caught my attention:

By the way, some people are building the ability to change color scheme into their code. This new one, PyIDM is using them and saving the user's choice in the system settings.

I have tried to do this, but I didn't find a way to make the Window color or LookAndFeel theme update in real time, and I got stuck with creating an external .pref file (pref stands for user preferences), which didn't seem too appealing for a portable app. Maybe I was doing something wrong. I'll try again. Now, I didn't really get what you meant by this; does their implementation require a preferences file like mine (perhaps that's what you mean by 'system settings') and a restart of the program to take effect or is it real time? I'm really curious. Pardon my questions, I know you aren't the maintainer of that project.

definite-d commented 4 years ago

Um, I've reached the part where I have to integrate the color manipulation module/functions. Your functions were what I picked first to integrate, but I required the ability to convert from HSL color, back to hex. To do that, I had to use the colour module in addition to your functions, but I was surprised when I got an error. I decided to try the module's ability to convert hex to HSL, and found that the results were different.

PySimpleGUI commented 4 years ago

I have tried to do this, but I didn't find a way to make the Window color or LookAndFeel theme update in real time, and I got stuck with creating an external .pref file (pref stands for user preferences), which didn't seem too appealing for a portable app.

Look at the project I sent you... PyIDM.

You will find his code is not all that long. The way everyone does the look and feel "switch over" is to completely close the old window and open a brand new one. A "restart" of sorts.

His code shows you how to save your settings in a JSON file and read them back. I've never done it and was surprised at how easy he made it look.

I learn a LOT from reading other people's PySimpleGUI code. I highly recommend reading other people's code. You can learn something for sure. Some aren't the best, but they have some hidden gems for me. Others have sequences of code, like saving settings, that can be lifted and used in your own code, just like you're doing with the color libraries from mine.

I have no clue, by the way, about how color systems work. I learn enough stuff to "get the job done" and then I'm off to the next thing. I'm not a deep dive kind of person unless I have to be.

I added the table header code last night. Now when Tables and Trees are created, the colors of the headers can be set. If none are set, I do the same kind of thing like I did for tabs, use the current look and feel table.

I'm going to create some better "access" functions so that programs can find the current background color easily.

But, for now, I need to jump over to the Graph element to fix some stuff and add "object" detection so that things can be dragged around on a Graph.

definite-d commented 4 years ago

Pretty cool. I checked out PyIDM, and I think I'll use it personally, aside from learning from its code.

As for the color picker, it's almost done. I'm just experimenting with different layouts for it. I honestly didn't know there was a dummy button as an element, but it came in handy as the color preview box. One more thing; I've built it as a separate entity from LookyFeely; only to be used through an import and a function call. I called it Colorpiq. It's pretty basic anyway, and it's got only RGB sliders. But, (I think I'm a tab addict) I could put sliders in tabs that function for other color schemes, as long as I can convert the input into the #RRGGBB format. That will probably be v2 for Colorpiq.

PySimpleGUI commented 4 years ago

I'm in the process of reworking the naming of the "Look and Feel" subsystem within PySimpleGUI.

theme is the new name of the capability. This will greatly simplify user code.

sg.theme('Dark Blue')

and

current_theme = theme()

Are a lot simpler, cleaner, easier to explain than

sg.change_look_and_feel('Dark Blue')

There are a number other functions that I'll be adding to enable access to the theme settings. If a button has an image with an alpha channel, then you need to know the background color the button will be placed on so that it matches. Right now it's a big messy expression. I'm thinking something like theme_background_color() would be the simple way to return the current background color that is being used for all new windows.

It'll take several days to get the names and stuff ironed out and several more to get it rolled out because it has to happen to all 4 ports simultaneously.

This kind of name change has happened throughout the evolution of PySimpleGUI. Old users can continue to user all the old function calls, but new users will only see examples using the new names. It's how the cookbook and demo programs have worked together in the past to evolve the names.

definite-d commented 4 years ago

Nice. I admit, PySimpleGUI is the only thing I know of that calls "themes" LookAndFeel schemes. I agree, having it renamed to "theme" will help new users.

Anyway, Colorpiq has been fully integrated into LookyFeely, as its official color picker. I'm still battling the Mono option. If done right, it'll be a far more advanced version of the Quick Mode idea. I'm thinking of doing this:

Just asking if this would be a good way to deal with Mono.

_(By the way, I already have the following variables at hand:

definite-d commented 4 years ago

Drum roll please...

:fireworks: :fireworks: :drum: LookyFeely v2 is complete! (but still undergoing testing, so it'll be out by Christmas :gift: :santa:).

For the speedsters (like you),...

For me, that was the name of the game... speed. It's why I downloaded all those pre-made palettes. They gave me a quick way to get matching colors, bypassing the need to manually dial-in colors. It meant losing a lot of the controls that you're providing. I presented myself with a much limited set of choices.

...all that's needed to make a theme is a name for the theme, 2 (minimum, I'm sorry; I'll probably have this reduced to 1 click based on saved settings) to 6 button clicks and a bit of copy pasting. The result? A theme with nice color arrangement (could be a mono theme or randomized; your call), with dark and light extra themes, all auto generated in seconds. And, you don't even have to click "Choose Color"! Not once! If you do click it, you don't have to click it 7 more times as provided for. That one color will be used to create a theme in its entirety. Plus, I've added the ability to update PySimpleGUI from LookyFeely, display all built in PySimpleGUI themes and all 150 supported semantic color names, from black to seashell and more.

More features are welcome; I'm thinking of a new addition to the Dark/Light Mode generation part: Gray-Out. This could take the Neutral theme color formula and convert every color there to grayscale. At least, if the user must use gray windows, they should do it in style.

Side note: I've learnt how to use emoji in GitHub comments. Mark that, M:arrow_down:.

definite-d commented 4 years ago

Merry Christmas, @MikeTheWatchGuy. :fireworks: :fireworks: :fireworks: :fireworks:

Well, ho ho ho, LookyFeely v2.0.9 is up (Sorry, the .9 came from additions that sprung up during testing). And I put a .exe of it on the repo as well. It was 'compiled'/'frozen' using PyInstaller.

I haven't tested the .exe, though. Hopefully, it won't call for an issue like that one on the PySimpleGUI repo about a .exe with the Pandas module being so large.

PySimpleGUI commented 4 years ago

Awesome! I've been waiting for this post.

Merry Christmas @definite-d

definite-d commented 4 years ago

Oh crud...

Hope you haven't opened the present :gift: yet... The last addition to LookyFeely I added before the GitHub upload yesterday, broke the Mono feature, and it didn't even work properly. Apologies, I should have this fixed soon.

definite-d commented 4 years ago

Well, I've fixed the major issues. I'm doing some 'mandatory' testing, but I'll be done in no time, and the patch will be up.

definite-d commented 4 years ago

The patch is up... All fixed.

definite-d commented 4 years ago

Hello once more, @PySimpleGUI.

Version 2.2 is coming soon... This time, I'm adding a feature (to LookyFeely) that might blow the minds of logo and graphic designers. Can you guess?

Anyway, before any commits, I would like your feedback on the initial v2, so I can make ammends if any are needed.

Side note: I played around with making a custom loading screen (similar to PyCharm's), and I noticed that when I used the 'no_titlebar' parameter of the Window element it had no ''window entry'' on my taskbar; which is exactly what I needed for such an application (loading screens don't need that stuff, right?). But that means stuff like custom/cool looking titlebars for windows (like Adobe Photoshop's titlebar) become unfeasible. (P.S., I use the Windows OS, like you probably do.)

definite-d commented 4 years ago

The loading screen turned out perfect by the way.

PySimpleGUI commented 4 years ago

Keep going. Keep innovating, trying new stuff, making change, refining, ....

Yes, no_titlebar is handy for a number of reasons, including the lack of icon on your taskbar. I recently described the phenomena in a "rainmeter widget" demo:

https://github.com/PySimpleGUI/PySimpleGUI-Rainmeter-CPU-Cores

As you've probably already seen in the animated GIF demos, the no-titlebar plays in an important role in these "loading" / splash screen types of windows:

https://github.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms/Demo_Animated_GIFs.py

The popup_quick_message is a capability I've leveraged quite a bit recently as it will stay visible beyond the "auto-close" time indicated in case the operation being performed takes longer than excepted. Because it's non-blocking, it doesn't cost anything to show one of these messages to users when about to go into some long operation.

definite-d commented 4 years ago

Alright! The latest feature of LookyFeely is nearly complete. At bare minimum, it works. Since you didn't guess that time, I'll tell you. It creates themes out of images.

PySimpleGUI commented 4 years ago

THAT is a cool thing!! I certainly don't have anything like that in the works.

Sorry it's taken so long to reply. I'm behind in everything at the moment.

definite-d commented 4 years ago

Hello again @PySimpleGUI. I totally understand not being able to reply; I've taken far too long to update this project myself!

Anyway, Version 2.2.2 is up. It's got the colors-from-images option, a gray out auto-gen mode, use of only dark default themes and a few minor changes.

Feel free to check it out, as usual.

PySimpleGUI commented 4 years ago

Hi there!

That's great news. I will definitely check it out!

I've been nose down lately, whenever I can be. Everything took a rather large hit over the past month. It's great to see you've kept things rolling, continuing to add, improve, create. They get better everything time, right? They seem to for me. This latest post is an example. There's a new popup_get_date because people have been asking for more control over the date-chooser. It's all PySimpleGUI code. There's nothing but standard calls used so it gives me practice at using the package too.

Gleaming colors from images is the platinum feature for programs like palette builders and image editors. This is a really cool idea.

definite-d commented 4 years ago

Hello again, @PySimpleGUI .

Well, now that ImagePalette is officially a thing and ready for use, I've decided to rewrite the Mono system (the thing that enables the user to base unspecified colors off those specified). It's a mess, from the developer perspective and the user perspective.

I'll keep you posted.

definite-d commented 4 years ago

The mono update is done, and I've even added a few things;

PySimpleGUI commented 4 years ago

Holy sh*t! This is amazing. I loaded up an image, which was really cool. And then I did the PREVIEW which was amazing! The progress meter was brilliant.

Damn man... this is going to be fun to play with. Got to spotlight this. I'll certainly do so, but it would be fantastic to post on Reddit. It's SUPER toxic there right now though. I don't even post my stuff on any Reddit python sub now. It's too emotionally risky for me. I dunno, getting attacked and downvoted after having working really hard on something sucks.

HOWEVER, the PySimpleGUI subreddit will eat this up. There's little risk there. Someone posted about the new YouTube videos I've been making. I hadn't thought of posting there about them. People that subscribe clearly want to hear about PySimpleGUI.

There is about to be an article released in one of the large Python newsletters / tutorial sites. This is going to stir up some interesting visits. I want to make sure people find you.

It would be good to do a collaborative thing in my Cookbook so I can get them to you as well as teach them how to integrate using the latest techniques. To be honest, I'm not sure of the best way. And maybe some new APIs should be added. Just thinking out loud here. Much more will come to me as I'm able to absorb this.

I would like to make 2 suggestions that I think will make it better. Not a big deal but would work better.

  1. The sliders that select the colors. I like the design look, but the functionality on my system was difficult. I had a hard time getting my mouse to click on the small spot needed to drag the slider. It's an unfortunate tkinter thing that is NOT at all your kind of fault. It's just how it's turning out. There ends up being making a 10x10 pixel area to grab if made small.

  2. Path to get to your image tool. That thing belongs on a LARGE BUTTON on your main screen. It's a whole product itself and should be the primary focus of this. I think it's a true "killer feature". The rest almost supports that feature rather than that feature filling in what they don't make by hand. Don't get me wrong the by hand stuff is still super important. It's good you've got a good interface for that. I'm just saying it shouldn't require a couple clicks to get to the image thing. It should be right there. Maybe make it a tab??? Even then make it super noticeable.

I hope you're proud of how far you've come with this project. Damn... it's really motivating seeing this kind of work. Congrats.

definite-d commented 4 years ago

Hello @PySimpleGUI !

Thanks for all the compliments! :smiley: Makes me feel good, knowing that my best PySimpleGUI program (so far) was built for PySimpleGUI users.

Well, knowing now that LookyFeely may get a huge boost in popularity, I'm going to have to make the code a bit more formal. I admit, I wrote that code too "freely". LookyFeely's name is a testimony to that. Also, that Help window needs help in itself... Maybe I should make some sort of online wiki or GitHub Pages site instead of a window. And if I do that, referring people on how to use LookyFeely would be easier.

About the Reddit thing; I agree with your opinion, it's okay to put it up on the PSG subreddit, but not the Python one. Honestly, I wouldn't have cared (too) much about some trolls' downvotes and snide remarks (even if it gets to me, I wouldn't stop working on LookyFeely; people need it), but risks are risky for a reason.

The YouTube, Cookbook and article... no problem there :thumbs-up:. Feel free to share whatever comes to you.

As for what you said about APIs... you kind of lost me there.

Due to your comment now, I've worked on Colorpiq and LookyFeely's use of it. Took 26 tweaks and runs to make the sliders a bit fatter and more clickable (they're kind of like worms instead of spaghetti now). I guess that helps with your 1st suggestion.

About your second suggestion, let me explain why I placed the ImagePalette feature where I did:

To be honest, I initially built ImagePalette as a tab. The first draft even had an image previewer planned (with a lenny or troll face if there was no image), but that image previewer required a timeout on the main window to operate as planned so I scrapped it anyway. Maybe I'll bring it back, now that ImagePalette has a window of its own. But it turns out, as I kept developing ImagePalette, I noticed how important it was to have customization of the potential theme to be generated, from the Specifier tab.

That didn't make much sense, did it? To explain, take this instance for example; I need to make a theme with the Instagram logo using ImagePalette. But I love dark modes, so I want my background to be #2b2b2b or some other shade of gray instead of the usual white. It would be handy if I could just slide over to my gray from Specifier and have the LookyFeely honor my choice (while ImagePalette does its job and gives me my Instagram theme), rather than use ImagePalette and edit code after (that method's not so... chic).

So I asked myself; how did I handle stuff like this before - special features that can be influenced by the colors specified (Mono and Random)? The answer was the "Unspecified Colors" Options window.

Unspecified Colors' options/features actually assume full control of the entire theme, but at the end of their job, they always have their result overridden by whatever colors the user actually specified. This gives the user freedom to do something like mixing and matching personal color choices with automatic results from LookyFeely's features.

Besides, I think it's quite the selling point to potential users that LookyFeely gives them the ability to entirely bypass >=18 clicks, Generate button included (for all-out specification of a theme) with literally just 3 clicks to have LookyFeely take care of that for them.

Actually, I don't see the Unspecified Options as mere fill-in robots. ImagePalette, Mono and Random (the 3 big features) don't care if you specified even one color. They'll work fine without anything being specified. In fact, during testing, I sometimes just blitz in "asdf" as the theme name and press Enter. Nothing else. The Unspecified Options work responsibly, and I always get a theme.

I totally understand your want for ImagePalette to be on the "front page" of LookyFeely though (I'm proud of it too), but please understand my boring reason.

By the way, here's the result that would come from my little Instagram scenario above (ImagePalette seemed to focus on the orange part more):

# Custom Instadark LookAndFeel Theme.
# Generated using LookyFeely.
import PySimpleGUI as sg  # Please change 'sg' to your liking.
sg.LOOK_AND_FEEL_TABLE['Instadark'] = {'BACKGROUND': 'black',
    'TEXT': 'white',
    'INPUT': '#feb841',
    'TEXT_INPUT': '#de2374',
    'SCROLL': '#bd914a',
    'BUTTON': ('#354a96', '#fa8830'),
    'PROGRESS': ('#4e5dd8', '#feb841'),
    'BORDER': 1,
    'SLIDER_DEPTH': 1,
    'PROGRESS_DEPTH': 0}

sg.ChangeLookAndFeel('Instad
ark')

Instagram Logo

Instadark

PySimpleGUI commented 4 years ago

"Toolchain". I don't know if you've worked in a software / artwork department and have encountered this concept before.

Basically there's a pipeline of tools that are used. Sometimes it's a strict ordering that's important. Other times they work together in a "mosaic" kind of way, sorta like a "toolbelt".

My "use case", my toolchain, and your's may be completely different. The tutorial I would like to write will describe a particular toolchain and how to use it to build PySimpleGUI themes.

For themes, I used a WIDE variety of tools to create them.

Here are a few of the tools I use for images / color on a regular basis: image

My plan has been to use your software as a replacement of a tool that I wrote and pretty sure I shared with you. There are 3 steps that I see in creating a theme.

  1. Palette selection - getting a group of 5 colors that will work together
  2. Arranging the colors / assigning them to the elements
  3. Generation of the Theme code

I just re-discovered that I covered a lot of this on this page where my original program is posted: https://github.com/PySimpleGUI/PySimpleGUI/tree/master/ThemeMaker

Your program doesn't fill all of the needs that I have, but does some. The reason the ImagePalette feature is so important to me is that it enables quick insertion of colors. I will not be using it on plain images and logos. Your tool fits into my toolchain in a particular way.

Finding colors that work together is something I rely on a lot of tools and websites to do. I've even purchased physical and ebooks of nothing but color palettes. Getting those color entered into a program has been a difficult process. Israel Dryer wrote a program that generated a py file that I use in the ThemeMaker code now. He enabled me to get a website's worth of color palettes into my code quickly and easily.

Looking again at my toolchain / mosaic of tools, I have PC based ones and online ones. A recent nice online find was this one: http://www.colorschemedesigner.com/csd-3.5/

It's the kind of tool that "designers" and "artistrs" would use.

image

It uses color-theory concepts that have been used countless times in creating art, web pages, etc. It is where many of us will go to get our initial colors. Most likely the sliders and manual controls that you've created are not how a designer would use your tool. They are likely to use something like the color schemer because they can get the computed "triad" colors based on an initial color. They can use all kinds of crazy technical color algorithms that are unlikely to be something you and I are able to put into our code.

This is why "toolchains" exist. It's so that you can use the best tool for a particular step, and then glue together all of the steps.

You have one use case and how you use your tool. I've been trying to describe the one I use and will document in a tutorial. It's how I've seen designers work in the past. There have been a number of companies I've worked at with artists and designers and I've got a little bit of an idea of how they work.

OK, so far I've talked about how to get the initial set of colors, the palette. From the online tool I showed above, I could likely create something like this image:

image

That may not be enough colors, so maybe the one from the same page with more choices

image

I would take parts of that and run them into your tool. This allows me to quickly "enter" the RGB values into your program.

THAT'S the primary purpose of I see of using the ImagePalette feature... it's to take palettes generated by other tools and then getting them loaded into your program.

It's the NEXT step that my suggestion for a "scramble" or "shuffle" button comes into play. Your code at the moment takes the colors I provide and gives me ONE option for creating a theme from them. I'm shown a single preview.

A single option is not enough. It's why I created my Theme Maker program to begin with.

Let's review how it worked. Given ONE of these groups of 5 or so colors, it presented the user with this GUI:

image

From those 4 squares of choices I believe it ends up making 2 actual themes.

Each of the 4 squares has a checkbox that when checked will cause a theme to be made using those settings.

Let's look at one of those squares.

image

What you see here are a couple of groups of radio buttons. The background is already set to the light yellow color. So that one can't be changed. But, the color of the text, the input text background, the input text input color, and the button colors (MOST importantly the button colors).

For the buttons there are 11 choices available. ELEVEN.

The color 140 color palettes shipping with PySimpleGUI were made using this kind of rigorous human interaction. They were not computed and shown as a single choice. There are too many combinations possible for a computer program to choose the "best to the human eye".


Pulling all this together.

Your program has turned into something that enables me to quickly load an image of a palette. Before I needed to rely on Israel's code or I had to hand enter them. Hand entering them isn't an option. Using your single color at a time method with sliders, for me, isn't a usable way to get colors into the program. It's simply too tedious and slow. Even copy and pasting the color codes is super slow compared to 'here's a photo of colors, find the RGB values and then let me see them'.

You've got a nice theme previewer too, similar to my Theme Maker's one. It's a very important part of this process / toolchain.

What's missing is the ability to modify WHAT each color is used for. You have an algorithm that puts into into 1 possibility. I need many more than that. The simplest way I could think of making that happen is to use a "shuffle" button that will re-arrange them randomly. Then it's a matter of clicking the shuffle over and over until a "winning combination" is found.

It's either a shuffle thing or I need something like my theme maker's level of choices. You've currently given me 1 choice. I need 11. I don't THINK you want to make an "editor" like window like the ones I created that enable one to assign the colors in a particular way... that is what these are all about:

image

The final bit of magic your code does well is generate the code needed for the user to be able to add the "right combination" to the PySimpleGUI package / their code. You've cracked the code at going from an arrangement of colors into code.


The hole....

The hole that is in the tool that I'm looking to get filled is the assignment of colors to elements. It's that square from the theme maker or a shuffle button on your interface. That's where I need some kind of addition. I almost added it yesterday but wasn't able to get it done before running out of time.


Code cleanup

I know you're concerned about how your code looks, but I wouldn't worry about it. Your application is not a "demo program". you have created an end-user application. It just happens to be one that helps out PySimpleGUI developers. I won't be sending people to look at your source code.

Just like I don't send people to the pyIDM project as an example of how to build a PySimpleGUI program. I send people there because it's a cool program and does what it's supposed to do very well.

Your program falls into this "application" category. There are more and more of these programs being written and released on GitHub. GitHub claims there are currently 636 projects using PySimpleGUI. To me, these are all applications. They are "products". They are not demo programs or templates meant to demonstrate how to make a program. They are standalone products.


Maybe my use case isn't what you're trying to build for and solve and that's OK. If you're happy with what you've built and you're finding other people are too, then that's great and you've got plenty to be proud of for sure.

I just saw a potential for putting together something that's a particular kind of design and development tool that I believe would be used by artists and designers. It could make for an interesting toolchain and tutorial. But if it's not meant to be, it's not meant to be. This is your project, meant to bring you and your users enjoyment. It's not a contracted / work-for-hire project that I'm paying you to make. Even if I'm not able to write a tutorial describing the toolchain that I described here, I'll still certainly be sending people over to use your tool. Ir's a fantastic creation that I'm sure people will enjoy using.

As long as you're enjoying this, that's what's important.

definite-d commented 4 years ago

Toolchains aren't new to me; your specific toolchain is what's new. Thanks for the in-depth explanation. And by the way, I'm actually also a graphic designer 😄.

Okay, I see what you mean. You require something that gives power over re-arrangement of colors, even after stuff like ImagePalette have played their part, right?. Sorry, but for convenience, could this specific matter (the shuffle button and/or other means to control arrangement) be dealt with in detail on issue #5 ?

That hole will be filled 👍 .