commit
9645f17295
|
@ -3430,7 +3430,7 @@ class Window:
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size=(None, None),
|
def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size=(None, None),
|
||||||
auto_size_text=None, auto_size_buttons=None, location=(None, None), size=(None, None), element_padding=None, button_color=None, font=None,
|
auto_size_text=None, auto_size_buttons=None, location=(None, None), size=(None, None), element_padding=None, margins=(None, None), button_color=None, font=None,
|
||||||
progress_bar_color=(None, None), background_color=None, border_depth=None, auto_close=False,
|
progress_bar_color=(None, None), background_color=None, border_depth=None, auto_close=False,
|
||||||
auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, force_toplevel=False,
|
auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, force_toplevel=False,
|
||||||
alpha_channel=1, return_keyboard_events=False, use_default_focus=True, text_justification=None,
|
alpha_channel=1, return_keyboard_events=False, use_default_focus=True, text_justification=None,
|
||||||
|
@ -3519,6 +3519,7 @@ class Window:
|
||||||
self.XFound = False
|
self.XFound = False
|
||||||
self.ElementPadding = element_padding or DEFAULT_ELEMENT_PADDING
|
self.ElementPadding = element_padding or DEFAULT_ELEMENT_PADDING
|
||||||
self.RightClickMenu = right_click_menu
|
self.RightClickMenu = right_click_menu
|
||||||
|
self.Margins = margins if margins != (None, None) else DEFAULT_MARGINS
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def IncrementOpenCount(self):
|
def IncrementOpenCount(self):
|
||||||
|
@ -5884,10 +5885,10 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form:Window):
|
||||||
# ............................DONE WITH ROW pack the row of widgets ..........................#
|
# ............................DONE WITH ROW pack the row of widgets ..........................#
|
||||||
# done with row, pack the row of widgets
|
# done with row, pack the row of widgets
|
||||||
# tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0])
|
# tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0])
|
||||||
tk_row_frame.pack(side=tk.TOP, anchor='nw', padx=DEFAULT_MARGINS[0], expand=False)
|
tk_row_frame.pack(side=tk.TOP, anchor='nw', padx=toplevel_form.Margins[0], expand=False)
|
||||||
if form.BackgroundColor is not None and form.BackgroundColor != COLOR_SYSTEM_DEFAULT:
|
if form.BackgroundColor is not None and form.BackgroundColor != COLOR_SYSTEM_DEFAULT:
|
||||||
tk_row_frame.configure(background=form.BackgroundColor)
|
tk_row_frame.configure(background=form.BackgroundColor)
|
||||||
toplevel_form.TKroot.configure(padx=DEFAULT_MARGINS[0], pady=DEFAULT_MARGINS[1])
|
toplevel_form.TKroot.configure(padx=toplevel_form.Margins[0], pady=toplevel_form.Margins[1])
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@ -7432,7 +7433,6 @@ def PopupGetText(message, title=None, default_text='', password_char='', size=(N
|
||||||
|
|
||||||
# --------------------------- PopupAnimated ---------------------------
|
# --------------------------- PopupAnimated ---------------------------
|
||||||
|
|
||||||
|
|
||||||
def PopupAnimated(image_source, message=None, background_color=None, text_color=None, font=None, no_titlebar=True, grab_anywhere=True, keep_on_top=True, location=(None, None), alpha_channel=.8, time_between_frames=0):
|
def PopupAnimated(image_source, message=None, background_color=None, text_color=None, font=None, no_titlebar=True, grab_anywhere=True, keep_on_top=True, location=(None, None), alpha_channel=.8, time_between_frames=0):
|
||||||
|
|
||||||
if image_source is None:
|
if image_source is None:
|
||||||
|
@ -7448,13 +7448,13 @@ def PopupAnimated(image_source, message=None, background_color=None, text_color=
|
||||||
layout.append([Text(message, background_color=background_color, text_color=text_color, font=font)])
|
layout.append([Text(message, background_color=background_color, text_color=text_color, font=font)])
|
||||||
|
|
||||||
window = Window('Animated GIF', no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top,
|
window = Window('Animated GIF', no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top,
|
||||||
background_color=background_color, location=location, alpha_channel=alpha_channel).Layout(layout).Finalize()
|
background_color=background_color, location=location, alpha_channel=alpha_channel, element_padding=(0,0), margins=(0,0)).Layout(layout).Finalize()
|
||||||
Window.animated_popup_dict[image_source] = window
|
Window.animated_popup_dict[image_source] = window
|
||||||
else:
|
else:
|
||||||
window = Window.animated_popup_dict[image_source]
|
window = Window.animated_popup_dict[image_source]
|
||||||
window.Element('_IMAGE_').UpdateAnimation(image_source, time_between_frames=time_between_frames)
|
window.Element('_IMAGE_').UpdateAnimation(image_source, time_between_frames=time_between_frames)
|
||||||
window.Refresh()
|
|
||||||
# button, values = window.Read(timeout=0)
|
window.Refresh() # call refresh instead of Read to save significant CPU time
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
54
readme.md
54
readme.md
|
@ -750,7 +750,36 @@ This is a typpical call
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
### PopupAnimated
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The animated Popup enables you to easily display a "loading" style animation specified through a GIF file that is either stored in a file or a base64 variable.
|
||||||
|
|
||||||
|
```python
|
||||||
|
def PopupAnimated(image_source,
|
||||||
|
message=None,
|
||||||
|
background_color=None,
|
||||||
|
text_color=None,
|
||||||
|
font=None,
|
||||||
|
no_titlebar=True,
|
||||||
|
grab_anywhere=True,
|
||||||
|
keep_on_top=True,
|
||||||
|
location=(None, None),
|
||||||
|
alpha_channel=.8,
|
||||||
|
time_between_frames=0)
|
||||||
|
```
|
||||||
|
image_source - The GIF file specified as a string filename or a base64 variable
|
||||||
|
message - optional text message to be displayed under the animation
|
||||||
|
background_color - the background color to use for the window and all of the other parts of the window
|
||||||
|
text_color - color to use for optional text
|
||||||
|
font - font to use for the optional text
|
||||||
|
no_titlebar - no titlebar window setting
|
||||||
|
location - location to show the window
|
||||||
|
alpha_channel - alpha channel to use for the window
|
||||||
|
time_between_frames - amount of time in milliseconds to use between frames
|
||||||
|
|
||||||
|
***To close animated popups***, call PopupAnimated with `image_source=None`. This will close all of the currently open PopupAnimated windows.
|
||||||
|
|
||||||
|
|
||||||
# Progress Meters!
|
# Progress Meters!
|
||||||
|
@ -4856,7 +4885,7 @@ Emergency patch release... going out same day as previous release
|
||||||
* Added type hints to some portions of the code
|
* Added type hints to some portions of the code
|
||||||
* Output element can be made invisible
|
* Output element can be made invisible
|
||||||
* Image sizing and subsample for Button images
|
* Image sizing and subsample for Button images
|
||||||
* Invisibility for ButtonMenus
|
* Invisibility for ButtonMenusup
|
||||||
* Attempt at specifying size of Column elements (limited success)
|
* Attempt at specifying size of Column elements (limited success)
|
||||||
* Table Element
|
* Table Element
|
||||||
* New row_colors parameter
|
* New row_colors parameter
|
||||||
|
@ -4963,27 +4992,6 @@ GNU Lesser General Public License (LGPL 3) +
|
||||||
|
|
||||||
## How Do I
|
## How Do I
|
||||||
Finally, I must thank the fine folks at How Do I.
|
Finally, I must thank the fine folks at How Do I.
|
||||||
https://github.com/gleitz/howdoi
|
|
||||||
Their utility has forever changed the way and pace in which I can program. I urge you to try the HowDoI.py application here on GitHub. Trust me, **it's going to be worth the effort!**
|
|
||||||
Here are the steps to run that application
|
|
||||||
|
|
||||||
Install howdoi:
|
|
||||||
pip install howdoi
|
|
||||||
Test your install:
|
|
||||||
python -m howdoi howdoi.py
|
|
||||||
To run it:
|
|
||||||
Python HowDoI.py
|
|
||||||
|
|
||||||
The pip command is all there is to the setup.
|
|
||||||
|
|
||||||
The way HowDoI works is that it uses your search term to look through stack overflow posts. It finds the best answer, gets the code from the answer, and presents it as a response. It gives you the correct answer OFTEN. It's a miracle that it work SO well.
|
|
||||||
For Python questions, I simply start my query with 'Python'. Let's say you forgot how to reverse a list in Python. When you run HowDoI and ask this question, this is what you'll see.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
In the hands of a competent programmer, this tool is **amazing**. It's a must-try kind of program that has completely changed my
|
|
||||||
<!--stackedit_data:
|
<!--stackedit_data:
|
||||||
eyJoaXN0b3J5IjpbMzI2MjQ0MTg3LC0xMTQ4NDkwNjIzXX0=
|
eyJoaXN0b3J5IjpbNDQ5NDMzMjQzLC0xMTQ4NDkwNjIzXX0=
|
||||||
-->
|
-->
|
Loading…
Reference in New Issue