mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Tk: set window icon
make_help_toplevel changed from Tk to Toplevel since Tk creates another Tcl interpreter, causing errors like this: '_tkinter.TclError: can't use "pyimage228" as iconphoto: not a photo image' 1024x1024 logo file is renamed because it has large margins on each side which is unsuitable for a window icon.
This commit is contained in:
parent
c6d093d995
commit
55edd37a72
5 changed files with 14 additions and 2 deletions
|
@ -30,7 +30,7 @@ p4a_options="\
|
||||||
--private ${tmpdir} \
|
--private ${tmpdir} \
|
||||||
--orientation sensor \
|
--orientation sensor \
|
||||||
--icon ${tmpdir}/data/images/icons/48x48/pysol.png \
|
--icon ${tmpdir}/data/images/icons/48x48/pysol.png \
|
||||||
--presplash ${tmpdir}/data/images/icons/1024x1024/pysol.png \
|
--presplash ${tmpdir}/data/images/logo-with-margin-1024.png \
|
||||||
--copy-libs \
|
--copy-libs \
|
||||||
--add-jar ${tmpdir}/support-v4-24.1.1.aar \
|
--add-jar ${tmpdir}/support-v4-24.1.1.aar \
|
||||||
--color always"
|
--color always"
|
||||||
|
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 73 KiB |
|
@ -110,7 +110,7 @@ def makeToplevel(parent, title=None):
|
||||||
def make_help_toplevel(app, title=None):
|
def make_help_toplevel(app, title=None):
|
||||||
# Create an independent Toplevel window.
|
# Create an independent Toplevel window.
|
||||||
from pysollib.winsystems import init_root_window
|
from pysollib.winsystems import init_root_window
|
||||||
window = tkinter.Tk(className=TITLE)
|
window = tkinter.Toplevel(class_=TITLE)
|
||||||
init_root_window(window, app)
|
init_root_window(window, app)
|
||||||
return window
|
return window
|
||||||
|
|
||||||
|
|
|
@ -167,5 +167,11 @@ class DataLoader:
|
||||||
filename += ('.ico' if os.name == 'nt' else '.xbm')
|
filename += ('.ico' if os.name == 'nt' else '.xbm')
|
||||||
return self.findFile(filename, subdirs)
|
return self.findFile(filename, subdirs)
|
||||||
|
|
||||||
|
def findAllIconSizes(self, filename='pysol.png'):
|
||||||
|
icondir = self.findDir(os.path.join('images', 'icons'))
|
||||||
|
icons = [os.path.join(icondir, subdir, filename) for subdir in
|
||||||
|
os.listdir(icondir)]
|
||||||
|
return filter(os.path.isfile, icons)
|
||||||
|
|
||||||
def findDir(self, filename, subdirs=None):
|
def findDir(self, filename, subdirs=None):
|
||||||
return self.__findFile(os.path.isdir, filename, subdirs)
|
return self.__findFile(os.path.isdir, filename, subdirs)
|
||||||
|
|
|
@ -32,6 +32,7 @@ from pysollib.settings import TOOLKIT, USE_TILE
|
||||||
from pysollib.settings import VERSION
|
from pysollib.settings import VERSION
|
||||||
|
|
||||||
if TOOLKIT == 'tk':
|
if TOOLKIT == 'tk':
|
||||||
|
from pysollib.ui.tktile.tkutil import loadImage
|
||||||
if USE_TILE:
|
if USE_TILE:
|
||||||
from six.moves import tkinter_ttk as ttk
|
from six.moves import tkinter_ttk as ttk
|
||||||
|
|
||||||
|
@ -89,6 +90,11 @@ def base_init_root_window(root, app):
|
||||||
# root.wm_group(root)
|
# root.wm_group(root)
|
||||||
root.wm_title(TITLE + ' ' + VERSION)
|
root.wm_title(TITLE + ' ' + VERSION)
|
||||||
root.wm_iconname(TITLE + ' ' + VERSION)
|
root.wm_iconname(TITLE + ' ' + VERSION)
|
||||||
|
|
||||||
|
if TOOLKIT == 'tk':
|
||||||
|
icons = [loadImage(img) for img in app.dataloader.findAllIconSizes()]
|
||||||
|
root.wm_iconphoto(True, *icons)
|
||||||
|
|
||||||
# set minsize
|
# set minsize
|
||||||
sw, sh = (root.winfo_screenwidth(), root.winfo_screenheight())
|
sw, sh = (root.winfo_screenwidth(), root.winfo_screenheight())
|
||||||
if sw < 640 or sh < 480:
|
if sw < 640 or sh < 480:
|
||||||
|
|
Loading…
Add table
Reference in a new issue