Closed MikeTheWatchGuy closed 5 years ago
Would like to release v1.0 within this week. Still doing some testing on engine configuration file.
Also looking at the board, there is something wrong on the left side.
The outline was missing. I will recheck my last modification on this part later. Once done v1.0 will be out.
I will be adding more features in the issues, there are lots that can be added, one of those is tactical trainer. User will be given puzzles to solve. There is also saving of games for opening repertoire.
Found the issue on board image, it was caused by the vertical coordinate number labels. Current quick fix is to remove altogether the file and rank coordinates.
Also set the border_width of the button to 0 to remove the line between squares. It would look like this now.
I am experimenting on Comment. User can comment and after making the move, that comment will be saved in the game.
Sorry I didn't answer fast enough for the border_depth problem. Certainly a flatter look now. Nice and clear. You can do the same with other elements should you wish to flatten everything.
It's a REALLY nice looking window., I would SWEAR this is not a Python program. Mean look at your menu! Wow. I used one of your screen shots as an example of "what's possible" today. It's impressive what you've built.
BTW, you can lose the "Board" tab and in fact the entire Tab and TabGroup. All you need is a Column to hold the board.
I too very much like the board now, with that am looking for the possibility to change board themes, but that will come later. I am also looking for the possibility that lookandfeel() can be changed dynamically that is after loading the default lookandfeel(), user can change it without restarting the program.
I hope to improve my code after releasing v1.0.
Regarding the tab, I did try dropping it and it looks cleaner. On the other hand I also thought that with tabs I can create independent view/functionality, like remove the Mode menu and use tabs instead, i.e I will have Play, Analyze and Database tabs. If user wants to play just press Play tab, if user wants to analyze a game just press Analyze tab. Each tab has its own different element layouts.
I had bought couple of commercial chess GUI's before such as Chessbase, Fritz, HCE (Hiarcs Chess Explorer), CPT (Chess Position Trainer), COW (Chess Opening Wizard) and Aquarium. Each has its own unique features.
You cannot use the ChangeLookAndFeel
call to modify an existing window. What it does is setup the default colors and settings so that when you create your elements and window, it'll use those settings.
As you know, the only mechanism to modify existing Elements is to use their Update method. There are a few other member functions besides Update
but that's the primary one to do things like change colors.
Be warned that not all settings are available to be changed to an element.
You could, however, offer a number of different looks to your user prior to creating the window. Show them a bunch of color swatches. Or, if you want to be able to do it after a board is drawn, then you'll need to do it one element at a time.
Another option when using look and feel is that there is the capability for you to extend the number of look and feel options by defining your own.
Thanks for this info, I will try a simple board coloring at first perhaps a blue color theme. Board->Theme->Brown (current) Board->Them->Blue
The board you could update in realtime without making a brand new window.
The Button Element's Update
method can change a button's color. As you already know from your screenshot, you can change the button colors on the fly.
I think it would be a cool feature to be able to change the board colors on the fly. It should be really easy. Double loop through the board, a single line to call the Update with a mod function to get alternating colors. I think that's how I made the original board.
I got the blue now, user can change it in Neutral mode at Board->Color->Brown / Blue. In the image Board menu is not present because it is in Play mode.
VERY nice!
This project is quickly becoming the one I send people to in response to Reddit posts that PySimpleGUI really sucks and is only good for trivial windows, at best.
I know it's a pain to get stuff to line up and your layout looks spot on, so I'm hoping there wasn't too much messing around with pixels and padding.
It looks great. I like the idea of "skinning" a board like that. I like the new icon too!
Hard to believe this is a Python program. It seems so rare to see anything that looks like a Windows program coming out of Python programming.
I got some design changes.
Blue board on TealMono gui theme.
Here is another, Brown board on SandyBeach.
The board color is outnumbered at the moment, I will be creating one for green board.
Oh wow! These are based on the built-in color schemes that I created and that's all?
How are you getting the 2 colors for the board?
If you wanted to switch to using only the data proved by the PySimpleGUI color scheme, you could use any 2 colors from the list of colors used for various items (input background color, text color, etc). One addition not many months back was the "Accent colors" that were added to these themes.
The idea was to provide a list of colors that "Match" the color pattern. Then you can use these extra colors to color other aspects of your GUI that are different than other colors used in the GUI but still matches.
The keys are ACCENT1
, ACCENT2
', ACCENT3
and can be looked up in the color table:
sg.LOOK_AND_FEEL_TABLE['LightGreen']['ACCENT1']
Unfortunately I didn't have time to go create these colors for many of the existing color pallets. They're only available in the newer ones like LightGreen, Topanga, Reddit.
BTW, if you come up with a color scheme of your own that you would like to share, I'll certainly consider adding it to the look and feel table. In fact, I would suggest you adding it to the look and feel table yourself, then accessing it through PySimpleGUI. This will allow you to compartmentalize the code that deals directly with hard coded color values to just the code that adds the data to the table. Then the rest of your code can use ACCENT1, etc, instead of '#36A3E6"
I peeked at the code and I saw this function. It still has hard coded colors. How did you made these boards with alternate board colors?
def render_square(self, image, key, location):
""" Returns an RButton (Read Button) with image image """
if (location[0] + location[1]) % 2:
color = '#B58863'
else:
color = '#F0D9B5'
return sg.RButton('', image_filename=image, size=(1, 1),
button_color=('white', color), pad=(0, 0), key=key)
Yes the themes are from built-in.
The code on render_square has been revised.
def render_square(self, image, key, location):
""" Returns an RButton (Read Button) with image image """
if (location[0] + location[1]) % 2:
color = self.sq_dark_color # Dark square
else:
color = self.sq_light_color
return sg.RButton('', image_filename=image, size=(1, 1), border_width=0,
button_color=('white', color), pad=(0, 0), key=key)
In Neutral mode, the loop has,
# Mode: Neutral, Change board color
if button == 'Blue':
self.sq_light_color = '#b9d6e8'
self.sq_dark_color = '#4790c0'
self.move_sq_light_color = '#d2e4ba'
self.move_sq_dark_color = '#91bc9c'
self.redraw_board()
self.window.Close()
# Create new window
layout = self.build_main_layout(theme=self.gui_theme)
self.window = sg.Window('{} {}'.format(APP_NAME, APP_VERSION),
layout, default_button_element_size=(12, 1),
auto_size_buttons=False,
icon='Icon/pecg.ico')
# Update White/Black boxes
while True:
button, value = self.window.Read(timeout=50)
self.update_labels_and_game_tags(human='Human')
break
continue
It is in build_main_layout() that I call the ChangeLookAndFeel()
def build_main_layout(self, theme='Reddit', flip=False):
"""
Build the main part of GUI, board is oriented with white at the bottom.
"""
sg.ChangeLookAndFeel(theme)
sg.SetOptions(margins=(0, 3), border_width=1)
self.psg_board = copy.deepcopy(initial_board)
board_layout = self.create_board(flip)
...
I am not familiar with these color schemes, will try to study it. Thanks for hints.
I see the look and feel table dictionary. It is nice, it is encouraging to create a theme.
Looks like a nice source to create themes. https://www.canva.com/learn/100-color-combinations/
Good color preview for white and black text/pieces to create chess board. https://www.w3schools.com/colors/colors_picker.asp
Oh great.... MORE color combination sites! I've got dozens already and stacks of tools to choose from too. Color Schemer, Color Cache that I use only for making pallets.
I would KILL for decent look and feel entries. I've spent so many weeks on this one thing. Heck, I'm into the years now seeing how I've been collecting color combinations for years. I'm an engineer, not an artist, so I have to steal all of my art stuff (including what colors look good together).
I'll add the combination site to my list. It looks good. I just need additional colors that I can mix based on those base colors.
If you want to render your squares using colors from the current "Look and feel", then you can grab some of the values from the look and feel table for a particular setting. You can choose the text color and input background for example. Or some other combination. I dunno. It's just an idea.
Got an interesting deadly bug discovered which I would like to share. After changing the theme, select engine opponent, goto Play mode. Start playing move, the engine could only reply up to 3 moves. But the engine is still there not consuming cpu as can be seen in task manager. According to log, the engine has started searching but no indication that it played its bestmove. The gui is responsive, you can press buttons but does not act as expected. Press "Move Now" does not work. Press "Neutral" to return to Neutral mode, nothing happens. Press "Exit" nothing happens. And after 8 minutes, Python 3.7 and GUI crashed!
Been looking at the memory usage they looked normal.
I run pecg.py in windows cmd shell, last part of message:
File "C:\Python37\lib\tkinter\__init__.py", line 332, in __del__
if self._tk.getboolean(self._tk.call("info", "exists", self._name)):
RuntimeError: main thread is not in main loop
Exception ignored in: <function Variable.__del__ at 0x00000000029B2EA0>
Traceback (most recent call last):
File "C:\Python37\lib\tkinter\__init__.py", line 332, in __del__
if self._tk.getboolean(self._tk.call("info", "exists", self._name)):
RuntimeError: main thread is not in main loop
Tcl_AsyncDelete: async handler deleted by the wrong thread
I suspect closing and creating new window when changing theme is the problem. But not easy to detect since the engine can play for a couple of moves.
I will try to fix this.
Looks like you're starving the Event Loop. GUIs will continue to function even when the application controlling them completely stops interacting with it. The result will be exactly what you saw.
The error message you've hit is a known problem with tkinter. There is no known solution. I hope this only happens when you get into this "hung" looking state.
If I was faced with this, knowing what little I do about the situation, I would move your engines (or anything that does processing) out into threads and run your GUI as the only thing that runs in the main thread.
You also have to be careful with the IDE you're running. If you're using IDLE, then you can expect to have trouble with PySimpleGUI as they are both running tkinter. IDLE has known issues debugging tkinter based programs.
I already have a separate threads for the engine.
I cannot solve the issues on theme so far, will find another approach. In the meantime just added Gray and Green chess board colors in addition to Brown and Blue. Default theme is Reddit.
What is the "theme Issue"?
I don't know what the state of the art is for Chess programs now, but your's is pretty mind blowing with those colors! Wow. Really pops.
This really could be a take-off kind of program given how empty the Python apace is in terms of end-user programs that can compete with commercial windows products.
The problem with Python competing with commercial programs or even looking like a commercial product but is free, is that no one wants to create a GUI. You kinda have to create a GUI if you want to get ANY Windows user to use your program. OK, any NORMAL Windows user.
I guess I don't need to convince you. LOL... but there are a bunch of people I run into that will argue that a command line program always beats a GUI one. Always??
Thanks for "representing" PySimpleGUI so nicely.
Lemme know again about the theme problem.
This is the issue that I cannot implement so far, because closing/creating new window would make the engine stop replying after 3 moves and the gui and python would crash after 8 minutes. I would try another way to allow the user to select the theme.
There are a lot of nice Chess GUI now both commercial and free. pecg is still far behind. Great features now is the ability to search databases and replay those games with engine analysis. Ability to analyze games automatically and be able to see what the engine has seen thru game replay. Can connect to chess servers to play online, able to see live events on the gui. Create opening repertoire, able to train on those repertoire, able to create opening books. Handle pgn files, add game, delete game, search game, analyze game, edit game, add annotation to a game, copy games to other pgn file. And there are so much more, process epd file, test engine with epd. Add tournament manager for engine vs engine matches, I would love to implement these but there are already GUI's that can handle pretty good on one or some of those features. I will try to start implementing something that is not yet implemented.
For correspondence player where the search for bestmove is the ultimate goal, a system can be developed that is while the engine is analyzing a position, save to a tree all the positions that it has seen so far. Then be able to display this tree in the gui as well, then allow the user to interact this tree, add move to analysis, delete move, extend the search depth of certain moves, the commercial program Aquarium has already done this. But there are still people who requested this feature.
Chessbase has DPA - Deep Position Analysis, a good feature to allow the engine to analyze automatically thru user settings controlling the number of brances to search, the length of principal variation allowed, search limit, depth limit etc. Chessbase has feature that while you are playing a game, an engine is run in background analyzing a user's move, after the game, the user can access this game and see its mistake etc. I would love to implement this, as this can save analysis time of the user. But first I have to release v1.0.
I really like that you're going after features that are under-served by existing products. Be the only package that does feature X really well and I could see you doing well. Heck, as I said before, I think just being a Python program that runs as an end user application is enough to make you special.
About release 1.0. What's the wait? What's the holdup? Why the perfection?
Is there something seriously wrong with it?
"Better to ship software that works pretty well than to never ship the perfect program". I'm a believer in the get the stuff out there and get feedback. When I look back at PySimpleGUI version 1.0, which I will be doing next week as we celebrate the 1 year anniversary since the release of 1.0 on tkinter. I'm picky about quality. Generally speaking, my sh_t don't crash. I take pride in that. But, I also am not afraid to ship things that have risk associated with them too.
I would love to see you ship this software so I can do a little marketing of my own.
It would be really cool someday to run it on repl.it. I may still do a pull request down the road where I bring the pieces inside the code so that you have maximum portability.
Been testing a couple of engines to play at full length that is until game is over. After all the current primary use of this GUI is for the user to play a game with some engines. Engine/GUI crash should be avoided or minimal. There are a couple of uci engines that would make the GUI crash, because there is a uci command where the engine does not support or something that Python-chess does not agree with the uci engine. Python-chess would raise an error and I need to handle this such that the GUI will not crash and issue a message to the user to replace such engine.
Also replace the text labels button with right click menu which is cool. No more fancy text coloring. All text labels are now by default so that the theme will not be affected.
Theming is back, user can now select theme and board color under board menu.
You're the second person I've seen using themes like this, allowing the user to directly choose from a list. I'm honored they're considered "good enough" to even show, lesswell being the list of choices.
Feel free to add your own. If they look good, we'll add them to the "official" built-in themes.
I think you have covered some nice themes already. Will inform you if I find a good one.
I re-located another of the sites with applications. This one I think will be important for you to get onto: https://github.com/mahmoud/awesome-python-applications
because there are already multiple other Chess programs (that you can borrow features from :-) Lucas Chess seems to be somewhat active.
But given how short of a timeperiod you've been on your program versus they're effort is wildly different. Check out how long it's been under development:
And your chess program's HUGE development cycle is:
Well, it's measured in days compared to measured in YEARS.
Adding feature to manage engines [install, edit, delete] is a good challenge, constructing different types of elements for engine options, and updating engines.json file is a lot of fun. Takes time though.
WOW!!!
I've never seen a settings screen like that one in PySimpleGUI. I'm relieved all the styling came out ok.
It's an amazing set of stuff you can tweak! I never had a clue there would be so many knobs to turn.
And the LONG list of available engines is really impressive. Excellent screen shot too :-) Captured all 3 windows.
Add time control feature.
Dear Ferdinand Mosca, Your tools and utilities helped me to a lot to improve my chess . Could you please fix the analysis mode to help me analyze my chess games or just release v1.0 before I get heart attack waiting for you to update this awesome chess Gui
If you need a good chess software with analysis, database managing etc, I would recommend this http://scidvspc.sourceforge.net/
Analysis feature in Python Easy Chess GUI will take some time.
I will issue a release candidate next week.
I hope it's OK if I use some of your screenshots. They're too impressive not to show! One has been in the readme for a while now
It is fine.
Thank you very much!!
Hmmmm... just thought of this... I think it would be good to add a section of "projects that use PySimpleGUI" to the User Manual and perhaps even a screen shot of each of them. People LOVE images. I've noticed it myself. I'm more likely to look into a github's code if I see an image of what it creates in the readme.
I think it is a good idea indeed because images are not lost easily. Using links alone to point to the projects that use PySimpleGUI may not be enough as most links might be broken/dead in the future.
The dead links is a point I had not thought of. Yours along with some others are in this section of the main docs.
https://pysimplegui.readthedocs.io/en/latest/#some-examples
I ask other PySimpleGUI users that post a github to put a screenshot in their readme and most hadn't thought of it and immediately go and do it :-) It really does help their cause and makes their entire project look better in my opinion. It changes readme text into readme + proof I wrote something that really works.
Version 1.0 is just released.
congratulations!
Thanks.
Are you officially released? Or, do you have a feature set that you're shooting for?
The reason I ask is that if you're "done" and like how it works, then you should get some publicity. I can help make some of that happen.
It looks really sharp! You've done a great job on this.
Let me know when you're ready to be promoted.