repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
iterative/dvc
dvc/analytics.py
Analytics.load
def load(path): """Loads analytics report from json file specified by path. Args: path (str): path to json file with analytics report. """ with open(path, "r") as fobj: analytics = Analytics(info=json.load(fobj)) os.unlink(path) return analytics
python
def load(path): """Loads analytics report from json file specified by path. Args: path (str): path to json file with analytics report. """ with open(path, "r") as fobj: analytics = Analytics(info=json.load(fobj)) os.unlink(path) return analytics
[ "def", "load", "(", "path", ")", ":", "with", "open", "(", "path", ",", "\"r\"", ")", "as", "fobj", ":", "analytics", "=", "Analytics", "(", "info", "=", "json", ".", "load", "(", "fobj", ")", ")", "os", ".", "unlink", "(", "path", ")", "return",...
Loads analytics report from json file specified by path. Args: path (str): path to json file with analytics report.
[ "Loads", "analytics", "report", "from", "json", "file", "specified", "by", "path", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/analytics.py#L72-L81
train
iterative/dvc
dvc/analytics.py
Analytics.collect
def collect(self): """Collect analytics report.""" from dvc.scm import SCM from dvc.utils import is_binary from dvc.repo import Repo from dvc.exceptions import NotDvcRepoError self.info[self.PARAM_DVC_VERSION] = __version__ self.info[self.PARAM_IS_BINARY] = is_bi...
python
def collect(self): """Collect analytics report.""" from dvc.scm import SCM from dvc.utils import is_binary from dvc.repo import Repo from dvc.exceptions import NotDvcRepoError self.info[self.PARAM_DVC_VERSION] = __version__ self.info[self.PARAM_IS_BINARY] = is_bi...
[ "def", "collect", "(", "self", ")", ":", "from", "dvc", ".", "scm", "import", "SCM", "from", "dvc", ".", "utils", "import", "is_binary", "from", "dvc", ".", "repo", "import", "Repo", "from", "dvc", ".", "exceptions", "import", "NotDvcRepoError", "self", ...
Collect analytics report.
[ "Collect", "analytics", "report", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/analytics.py#L164-L181
train
iterative/dvc
dvc/analytics.py
Analytics.collect_cmd
def collect_cmd(self, args, ret): """Collect analytics info from a CLI command.""" from dvc.command.daemon import CmdDaemonAnalytics assert isinstance(ret, int) or ret is None if ret is not None: self.info[self.PARAM_CMD_RETURN_CODE] = ret if args is not None and h...
python
def collect_cmd(self, args, ret): """Collect analytics info from a CLI command.""" from dvc.command.daemon import CmdDaemonAnalytics assert isinstance(ret, int) or ret is None if ret is not None: self.info[self.PARAM_CMD_RETURN_CODE] = ret if args is not None and h...
[ "def", "collect_cmd", "(", "self", ",", "args", ",", "ret", ")", ":", "from", "dvc", ".", "command", ".", "daemon", "import", "CmdDaemonAnalytics", "assert", "isinstance", "(", "ret", ",", "int", ")", "or", "ret", "is", "None", "if", "ret", "is", "not"...
Collect analytics info from a CLI command.
[ "Collect", "analytics", "info", "from", "a", "CLI", "command", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/analytics.py#L183-L194
train
iterative/dvc
dvc/analytics.py
Analytics.dump
def dump(self): """Save analytics report to a temporary file. Returns: str: path to the temporary file that contains the analytics report. """ import tempfile with tempfile.NamedTemporaryFile(delete=False, mode="w") as fobj: json.dump(self.info, fobj) ...
python
def dump(self): """Save analytics report to a temporary file. Returns: str: path to the temporary file that contains the analytics report. """ import tempfile with tempfile.NamedTemporaryFile(delete=False, mode="w") as fobj: json.dump(self.info, fobj) ...
[ "def", "dump", "(", "self", ")", ":", "import", "tempfile", "with", "tempfile", ".", "NamedTemporaryFile", "(", "delete", "=", "False", ",", "mode", "=", "\"w\"", ")", "as", "fobj", ":", "json", ".", "dump", "(", "self", ".", "info", ",", "fobj", ")"...
Save analytics report to a temporary file. Returns: str: path to the temporary file that contains the analytics report.
[ "Save", "analytics", "report", "to", "a", "temporary", "file", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/analytics.py#L196-L206
train
iterative/dvc
dvc/analytics.py
Analytics.send_cmd
def send_cmd(cmd, args, ret): """Collect and send analytics for CLI command. Args: args (list): parsed args for the CLI command. ret (int): return value of the CLI command. """ from dvc.daemon import daemon if not Analytics._is_enabled(cmd): ...
python
def send_cmd(cmd, args, ret): """Collect and send analytics for CLI command. Args: args (list): parsed args for the CLI command. ret (int): return value of the CLI command. """ from dvc.daemon import daemon if not Analytics._is_enabled(cmd): ...
[ "def", "send_cmd", "(", "cmd", ",", "args", ",", "ret", ")", ":", "from", "dvc", ".", "daemon", "import", "daemon", "if", "not", "Analytics", ".", "_is_enabled", "(", "cmd", ")", ":", "return", "analytics", "=", "Analytics", "(", ")", "analytics", ".",...
Collect and send analytics for CLI command. Args: args (list): parsed args for the CLI command. ret (int): return value of the CLI command.
[ "Collect", "and", "send", "analytics", "for", "CLI", "command", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/analytics.py#L247-L261
train
iterative/dvc
dvc/analytics.py
Analytics.send
def send(self): """Collect and send analytics.""" import requests if not self._is_enabled(): return self.collect() logger.debug("Sending analytics: {}".format(self.info)) try: requests.post(self.URL, json=self.info, timeout=self.TIMEOUT_POST) ...
python
def send(self): """Collect and send analytics.""" import requests if not self._is_enabled(): return self.collect() logger.debug("Sending analytics: {}".format(self.info)) try: requests.post(self.URL, json=self.info, timeout=self.TIMEOUT_POST) ...
[ "def", "send", "(", "self", ")", ":", "import", "requests", "if", "not", "self", ".", "_is_enabled", "(", ")", ":", "return", "self", ".", "collect", "(", ")", "logger", ".", "debug", "(", "\"Sending analytics: {}\"", ".", "format", "(", "self", ".", "...
Collect and send analytics.
[ "Collect", "and", "send", "analytics", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/analytics.py#L263-L277
train
iterative/dvc
dvc/scm/git/tree.py
GitTree.walk
def walk(self, top, topdown=True, ignore_file_handler=None): """Directory tree generator. See `os.walk` for the docs. Differences: - no support for symlinks - it could raise exceptions, there is no onerror argument """ tree = self.git_object_by_path(top) if tree...
python
def walk(self, top, topdown=True, ignore_file_handler=None): """Directory tree generator. See `os.walk` for the docs. Differences: - no support for symlinks - it could raise exceptions, there is no onerror argument """ tree = self.git_object_by_path(top) if tree...
[ "def", "walk", "(", "self", ",", "top", ",", "topdown", "=", "True", ",", "ignore_file_handler", "=", "None", ")", ":", "tree", "=", "self", ".", "git_object_by_path", "(", "top", ")", "if", "tree", "is", "None", ":", "raise", "IOError", "(", "errno", ...
Directory tree generator. See `os.walk` for the docs. Differences: - no support for symlinks - it could raise exceptions, there is no onerror argument
[ "Directory", "tree", "generator", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/scm/git/tree.py#L126-L139
train
iterative/dvc
dvc/data_cloud.py
DataCloud.push
def push(self, targets, jobs=None, remote=None, show_checksums=False): """Push data items in a cloud-agnostic way. Args: targets (list): list of targets to push to the cloud. jobs (int): number of jobs that can be running simultaneously. remote (dvc.remote.base.Remot...
python
def push(self, targets, jobs=None, remote=None, show_checksums=False): """Push data items in a cloud-agnostic way. Args: targets (list): list of targets to push to the cloud. jobs (int): number of jobs that can be running simultaneously. remote (dvc.remote.base.Remot...
[ "def", "push", "(", "self", ",", "targets", ",", "jobs", "=", "None", ",", "remote", "=", "None", ",", "show_checksums", "=", "False", ")", ":", "return", "self", ".", "repo", ".", "cache", ".", "local", ".", "push", "(", "targets", ",", "jobs", "=...
Push data items in a cloud-agnostic way. Args: targets (list): list of targets to push to the cloud. jobs (int): number of jobs that can be running simultaneously. remote (dvc.remote.base.RemoteBase): optional remote to push to. By default remote from core.re...
[ "Push", "data", "items", "in", "a", "cloud", "-", "agnostic", "way", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/data_cloud.py#L117-L133
train
iterative/dvc
dvc/data_cloud.py
DataCloud.status
def status(self, targets, jobs=None, remote=None, show_checksums=False): """Check status of data items in a cloud-agnostic way. Args: targets (list): list of targets to check status for. jobs (int): number of jobs that can be running simultaneously. remote (dvc.remot...
python
def status(self, targets, jobs=None, remote=None, show_checksums=False): """Check status of data items in a cloud-agnostic way. Args: targets (list): list of targets to check status for. jobs (int): number of jobs that can be running simultaneously. remote (dvc.remot...
[ "def", "status", "(", "self", ",", "targets", ",", "jobs", "=", "None", ",", "remote", "=", "None", ",", "show_checksums", "=", "False", ")", ":", "cloud", "=", "self", ".", "_get_cloud", "(", "remote", ",", "\"status\"", ")", "return", "self", ".", ...
Check status of data items in a cloud-agnostic way. Args: targets (list): list of targets to check status for. jobs (int): number of jobs that can be running simultaneously. remote (dvc.remote.base.RemoteBase): optional remote to compare targets to. By defaul...
[ "Check", "status", "of", "data", "items", "in", "a", "cloud", "-", "agnostic", "way", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/data_cloud.py#L153-L168
train
iterative/dvc
dvc/repo/brancher.py
brancher
def brancher( # noqa: E302 self, branches=None, all_branches=False, tags=None, all_tags=False ): """Generator that iterates over specified revisions. Args: branches (list): a list of branches to iterate over. all_branches (bool): iterate over all available branches. tags (list): a ...
python
def brancher( # noqa: E302 self, branches=None, all_branches=False, tags=None, all_tags=False ): """Generator that iterates over specified revisions. Args: branches (list): a list of branches to iterate over. all_branches (bool): iterate over all available branches. tags (list): a ...
[ "def", "brancher", "(", "# noqa: E302", "self", ",", "branches", "=", "None", ",", "all_branches", "=", "False", ",", "tags", "=", "None", ",", "all_tags", "=", "False", ")", ":", "if", "not", "any", "(", "[", "branches", ",", "all_branches", ",", "tag...
Generator that iterates over specified revisions. Args: branches (list): a list of branches to iterate over. all_branches (bool): iterate over all available branches. tags (list): a list of tags to iterate over. all_tags (bool): iterate over all available tags. Yields: ...
[ "Generator", "that", "iterates", "over", "specified", "revisions", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/repo/brancher.py#L1-L56
train
iterative/dvc
dvc/state.py
State.changed
def changed(self, path, md5): """Check if file/directory has the expected md5. Args: path (str): path to the file/directory to check. md5 (str): expected md5. Returns: bool: True if path has the expected md5, False otherwise. """ actual = sel...
python
def changed(self, path, md5): """Check if file/directory has the expected md5. Args: path (str): path to the file/directory to check. md5 (str): expected md5. Returns: bool: True if path has the expected md5, False otherwise. """ actual = sel...
[ "def", "changed", "(", "self", ",", "path", ",", "md5", ")", ":", "actual", "=", "self", ".", "update", "(", "path", ")", "msg", "=", "\"File '{}', md5 '{}', actual '{}'\"", "logger", ".", "debug", "(", "msg", ".", "format", "(", "path", ",", "md5", ",...
Check if file/directory has the expected md5. Args: path (str): path to the file/directory to check. md5 (str): expected md5. Returns: bool: True if path has the expected md5, False otherwise.
[ "Check", "if", "file", "/", "directory", "has", "the", "expected", "md5", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/state.py#L119-L137
train
iterative/dvc
dvc/state.py
State.load
def load(self): """Loads state database.""" retries = 1 while True: assert self.database is None assert self.cursor is None assert self.inserts == 0 empty = not os.path.exists(self.state_file) self.database = sqlite3.connect(self.state_...
python
def load(self): """Loads state database.""" retries = 1 while True: assert self.database is None assert self.cursor is None assert self.inserts == 0 empty = not os.path.exists(self.state_file) self.database = sqlite3.connect(self.state_...
[ "def", "load", "(", "self", ")", ":", "retries", "=", "1", "while", "True", ":", "assert", "self", ".", "database", "is", "None", "assert", "self", ".", "cursor", "is", "None", "assert", "self", ".", "inserts", "==", "0", "empty", "=", "not", "os", ...
Loads state database.
[ "Loads", "state", "database", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/state.py#L214-L240
train
iterative/dvc
dvc/state.py
State.dump
def dump(self): """Saves state database.""" assert self.database is not None cmd = "SELECT count from {} WHERE rowid={}" self._execute(cmd.format(self.STATE_INFO_TABLE, self.STATE_INFO_ROW)) ret = self._fetchall() assert len(ret) == 1 assert len(ret[0]) == 1 ...
python
def dump(self): """Saves state database.""" assert self.database is not None cmd = "SELECT count from {} WHERE rowid={}" self._execute(cmd.format(self.STATE_INFO_TABLE, self.STATE_INFO_ROW)) ret = self._fetchall() assert len(ret) == 1 assert len(ret[0]) == 1 ...
[ "def", "dump", "(", "self", ")", ":", "assert", "self", ".", "database", "is", "not", "None", "cmd", "=", "\"SELECT count from {} WHERE rowid={}\"", "self", ".", "_execute", "(", "cmd", ".", "format", "(", "self", ".", "STATE_INFO_TABLE", ",", "self", ".", ...
Saves state database.
[ "Saves", "state", "database", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/state.py#L248-L299
train
iterative/dvc
dvc/state.py
State.save
def save(self, path_info, checksum): """Save checksum for the specified path info. Args: path_info (dict): path_info to save checksum for. checksum (str): checksum to save. """ assert path_info["scheme"] == "local" assert checksum is not None pat...
python
def save(self, path_info, checksum): """Save checksum for the specified path info. Args: path_info (dict): path_info to save checksum for. checksum (str): checksum to save. """ assert path_info["scheme"] == "local" assert checksum is not None pat...
[ "def", "save", "(", "self", ",", "path_info", ",", "checksum", ")", ":", "assert", "path_info", "[", "\"scheme\"", "]", "==", "\"local\"", "assert", "checksum", "is", "not", "None", "path", "=", "path_info", "[", "\"path\"", "]", "assert", "os", ".", "pa...
Save checksum for the specified path info. Args: path_info (dict): path_info to save checksum for. checksum (str): checksum to save.
[ "Save", "checksum", "for", "the", "specified", "path", "info", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/state.py#L367-L392
train
iterative/dvc
dvc/state.py
State.get
def get(self, path_info): """Gets the checksum for the specified path info. Checksum will be retrieved from the state database if available. Args: path_info (dict): path info to get the checksum for. Returns: str or None: checksum for the specified path info or ...
python
def get(self, path_info): """Gets the checksum for the specified path info. Checksum will be retrieved from the state database if available. Args: path_info (dict): path info to get the checksum for. Returns: str or None: checksum for the specified path info or ...
[ "def", "get", "(", "self", ",", "path_info", ")", ":", "assert", "path_info", "[", "\"scheme\"", "]", "==", "\"local\"", "path", "=", "path_info", "[", "\"path\"", "]", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "return", "...
Gets the checksum for the specified path info. Checksum will be retrieved from the state database if available. Args: path_info (dict): path info to get the checksum for. Returns: str or None: checksum for the specified path info or None if it doesn't exist ...
[ "Gets", "the", "checksum", "for", "the", "specified", "path", "info", ".", "Checksum", "will", "be", "retrieved", "from", "the", "state", "database", "if", "available", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/state.py#L394-L423
train
iterative/dvc
dvc/state.py
State.save_link
def save_link(self, path_info): """Adds the specified path to the list of links created by dvc. This list is later used on `dvc checkout` to cleanup old links. Args: path_info (dict): path info to add to the list of links. """ assert path_info["scheme"] == "local" ...
python
def save_link(self, path_info): """Adds the specified path to the list of links created by dvc. This list is later used on `dvc checkout` to cleanup old links. Args: path_info (dict): path info to add to the list of links. """ assert path_info["scheme"] == "local" ...
[ "def", "save_link", "(", "self", ",", "path_info", ")", ":", "assert", "path_info", "[", "\"scheme\"", "]", "==", "\"local\"", "path", "=", "path_info", "[", "\"path\"", "]", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "return...
Adds the specified path to the list of links created by dvc. This list is later used on `dvc checkout` to cleanup old links. Args: path_info (dict): path info to add to the list of links.
[ "Adds", "the", "specified", "path", "to", "the", "list", "of", "links", "created", "by", "dvc", ".", "This", "list", "is", "later", "used", "on", "dvc", "checkout", "to", "cleanup", "old", "links", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/state.py#L425-L448
train
iterative/dvc
dvc/state.py
State.remove_unused_links
def remove_unused_links(self, used): """Removes all saved links except the ones that are used. Args: used (list): list of used links that should not be removed. """ unused = [] self._execute("SELECT * FROM {}".format(self.LINK_STATE_TABLE)) for row in self.c...
python
def remove_unused_links(self, used): """Removes all saved links except the ones that are used. Args: used (list): list of used links that should not be removed. """ unused = [] self._execute("SELECT * FROM {}".format(self.LINK_STATE_TABLE)) for row in self.c...
[ "def", "remove_unused_links", "(", "self", ",", "used", ")", ":", "unused", "=", "[", "]", "self", ".", "_execute", "(", "\"SELECT * FROM {}\"", ".", "format", "(", "self", ".", "LINK_STATE_TABLE", ")", ")", "for", "row", "in", "self", ".", "cursor", ":"...
Removes all saved links except the ones that are used. Args: used (list): list of used links that should not be removed.
[ "Removes", "all", "saved", "links", "except", "the", "ones", "that", "are", "used", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/state.py#L450-L480
train
iterative/dvc
dvc/command/metrics.py
show_metrics
def show_metrics(metrics, all_branches=False, all_tags=False): """ Args: metrics (list): Where each element is either a `list` if an xpath was specified, otherwise a `str` """ for branch, val in metrics.items(): if all_branches or all_tags: logger.info("{branch}:"...
python
def show_metrics(metrics, all_branches=False, all_tags=False): """ Args: metrics (list): Where each element is either a `list` if an xpath was specified, otherwise a `str` """ for branch, val in metrics.items(): if all_branches or all_tags: logger.info("{branch}:"...
[ "def", "show_metrics", "(", "metrics", ",", "all_branches", "=", "False", ",", "all_tags", "=", "False", ")", ":", "for", "branch", ",", "val", "in", "metrics", ".", "items", "(", ")", ":", "if", "all_branches", "or", "all_tags", ":", "logger", ".", "i...
Args: metrics (list): Where each element is either a `list` if an xpath was specified, otherwise a `str`
[ "Args", ":", "metrics", "(", "list", ")", ":", "Where", "each", "element", "is", "either", "a", "list", "if", "an", "xpath", "was", "specified", "otherwise", "a", "str" ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/command/metrics.py#L13-L33
train
iterative/dvc
dvc/lock.py
Lock.lock
def lock(self): """Acquire lock for dvc repo.""" try: self._do_lock() return except LockError: time.sleep(self.TIMEOUT) self._do_lock()
python
def lock(self): """Acquire lock for dvc repo.""" try: self._do_lock() return except LockError: time.sleep(self.TIMEOUT) self._do_lock()
[ "def", "lock", "(", "self", ")", ":", "try", ":", "self", ".", "_do_lock", "(", ")", "return", "except", "LockError", ":", "time", ".", "sleep", "(", "self", ".", "TIMEOUT", ")", "self", ".", "_do_lock", "(", ")" ]
Acquire lock for dvc repo.
[ "Acquire", "lock", "for", "dvc", "repo", "." ]
8bb21261e34c9632453e09090de7ebe50e38d341
https://github.com/iterative/dvc/blob/8bb21261e34c9632453e09090de7ebe50e38d341/dvc/lock.py#L41-L49
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Desktop_Widget_Email_Notification.py
read_mail
def read_mail(window): """ Reads late emails from IMAP server and displays them in the Window :param window: window to display emails in :return: """ mail = imaplib.IMAP4_SSL(IMAP_SERVER) (retcode, capabilities) = mail.login(LOGIN_EMAIL, LOGIN_PASSWORD) mail.list() typ, data = mail....
python
def read_mail(window): """ Reads late emails from IMAP server and displays them in the Window :param window: window to display emails in :return: """ mail = imaplib.IMAP4_SSL(IMAP_SERVER) (retcode, capabilities) = mail.login(LOGIN_EMAIL, LOGIN_PASSWORD) mail.list() typ, data = mail....
[ "def", "read_mail", "(", "window", ")", ":", "mail", "=", "imaplib", ".", "IMAP4_SSL", "(", "IMAP_SERVER", ")", "(", "retcode", ",", "capabilities", ")", "=", "mail", ".", "login", "(", "LOGIN_EMAIL", ",", "LOGIN_PASSWORD", ")", "mail", ".", "list", "(",...
Reads late emails from IMAP server and displays them in the Window :param window: window to display emails in :return:
[ "Reads", "late", "emails", "from", "IMAP", "server", "and", "displays", "them", "in", "the", "Window", ":", "param", "window", ":", "window", "to", "display", "emails", "in", ":", "return", ":" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Desktop_Widget_Email_Notification.py#L67-L101
train
PySimpleGUI/PySimpleGUI
exemaker/pysimplegui-exemaker/pysimplegui-exemaker.py
runCommand
def runCommand(cmd, timeout=None): """ run shell command @param cmd: command to execute @param timeout: timeout for command execution @return: (return code from command, command output) """ p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) output = '' out, er...
python
def runCommand(cmd, timeout=None): """ run shell command @param cmd: command to execute @param timeout: timeout for command execution @return: (return code from command, command output) """ p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) output = '' out, er...
[ "def", "runCommand", "(", "cmd", ",", "timeout", "=", "None", ")", ":", "p", "=", "subprocess", ".", "Popen", "(", "cmd", ",", "shell", "=", "True", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "STDOUT", ")", ...
run shell command @param cmd: command to execute @param timeout: timeout for command execution @return: (return code from command, command output)
[ "run", "shell", "command" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/exemaker/pysimplegui-exemaker/pysimplegui-exemaker.py#L59-L73
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWeb/Demo Programs/Web_psutil_Kill_Processes.py
kill_proc_tree
def kill_proc_tree(pid, sig=signal.SIGTERM, include_parent=True, timeout=None, on_terminate=None): """Kill a process tree (including grandchildren) with signal "sig" and return a (gone, still_alive) tuple. "on_terminate", if specified, is a callabck function which is called as soon as...
python
def kill_proc_tree(pid, sig=signal.SIGTERM, include_parent=True, timeout=None, on_terminate=None): """Kill a process tree (including grandchildren) with signal "sig" and return a (gone, still_alive) tuple. "on_terminate", if specified, is a callabck function which is called as soon as...
[ "def", "kill_proc_tree", "(", "pid", ",", "sig", "=", "signal", ".", "SIGTERM", ",", "include_parent", "=", "True", ",", "timeout", "=", "None", ",", "on_terminate", "=", "None", ")", ":", "if", "pid", "==", "os", ".", "getpid", "(", ")", ":", "raise...
Kill a process tree (including grandchildren) with signal "sig" and return a (gone, still_alive) tuple. "on_terminate", if specified, is a callabck function which is called as soon as a child terminates.
[ "Kill", "a", "process", "tree", "(", "including", "grandchildren", ")", "with", "signal", "sig", "and", "return", "a", "(", "gone", "still_alive", ")", "tuple", ".", "on_terminate", "if", "specified", "is", "a", "callabck", "function", "which", "is", "called...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWeb/Demo Programs/Web_psutil_Kill_Processes.py#L16-L33
train
PySimpleGUI/PySimpleGUI
PySimpleGUI27.py
Popup
def Popup(*args, **_3to2kwargs): if 'location' in _3to2kwargs: location = _3to2kwargs['location']; del _3to2kwargs['location'] else: location = (None, None) if 'keep_on_top' in _3to2kwargs: keep_on_top = _3to2kwargs['keep_on_top']; del _3to2kwargs['keep_on_top'] else: keep_on_top = False if 'grab_an...
python
def Popup(*args, **_3to2kwargs): if 'location' in _3to2kwargs: location = _3to2kwargs['location']; del _3to2kwargs['location'] else: location = (None, None) if 'keep_on_top' in _3to2kwargs: keep_on_top = _3to2kwargs['keep_on_top']; del _3to2kwargs['keep_on_top'] else: keep_on_top = False if 'grab_an...
[ "def", "Popup", "(", "*", "args", ",", "*", "*", "_3to2kwargs", ")", ":", "if", "'location'", "in", "_3to2kwargs", ":", "location", "=", "_3to2kwargs", "[", "'location'", "]", "del", "_3to2kwargs", "[", "'location'", "]", "else", ":", "location", "=", "(...
Popup - Display a popup box with as many parms as you wish to include :param args: :param button_color: :param background_color: :param text_color: :param button_type: :param auto_close: :param auto_close_duration: :param non_blocking: :param icon: :param line_width: :param f...
[ "Popup", "-", "Display", "a", "popup", "box", "with", "as", "many", "parms", "as", "you", "wish", "to", "include", ":", "param", "args", ":", ":", "param", "button_color", ":", ":", "param", "background_color", ":", ":", "param", "text_color", ":", ":", ...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUI27.py#L7037-L7156
train
PySimpleGUI/PySimpleGUI
PySimpleGUI27.py
PopupNoButtons
def PopupNoButtons(*args, **_3to2kwargs): if 'location' in _3to2kwargs: location = _3to2kwargs['location']; del _3to2kwargs['location'] else: location = (None, None) if 'keep_on_top' in _3to2kwargs: keep_on_top = _3to2kwargs['keep_on_top']; del _3to2kwargs['keep_on_top'] else: keep_on_top = False if...
python
def PopupNoButtons(*args, **_3to2kwargs): if 'location' in _3to2kwargs: location = _3to2kwargs['location']; del _3to2kwargs['location'] else: location = (None, None) if 'keep_on_top' in _3to2kwargs: keep_on_top = _3to2kwargs['keep_on_top']; del _3to2kwargs['keep_on_top'] else: keep_on_top = False if...
[ "def", "PopupNoButtons", "(", "*", "args", ",", "*", "*", "_3to2kwargs", ")", ":", "if", "'location'", "in", "_3to2kwargs", ":", "location", "=", "_3to2kwargs", "[", "'location'", "]", "del", "_3to2kwargs", "[", "'location'", "]", "else", ":", "location", ...
Show a Popup but without any buttons :param args: :param button_color: :param background_color: :param text_color: :param auto_close: :param auto_close_duration: :param non_blocking: :param icon: :param line_width: :param font: :param no_titlebar: :param grab_anywhere: ...
[ "Show", "a", "Popup", "but", "without", "any", "buttons", ":", "param", "args", ":", ":", "param", "button_color", ":", ":", "param", "background_color", ":", ":", "param", "text_color", ":", ":", "param", "auto_close", ":", ":", "param", "auto_close_duratio...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUI27.py#L7169-L7220
train
PySimpleGUI/PySimpleGUI
PySimpleGUI27.py
PopupError
def PopupError(*args, **_3to2kwargs): if 'location' in _3to2kwargs: location = _3to2kwargs['location']; del _3to2kwargs['location'] else: location = (None, None) if 'keep_on_top' in _3to2kwargs: keep_on_top = _3to2kwargs['keep_on_top']; del _3to2kwargs['keep_on_top'] else: keep_on_top = False if 'gr...
python
def PopupError(*args, **_3to2kwargs): if 'location' in _3to2kwargs: location = _3to2kwargs['location']; del _3to2kwargs['location'] else: location = (None, None) if 'keep_on_top' in _3to2kwargs: keep_on_top = _3to2kwargs['keep_on_top']; del _3to2kwargs['keep_on_top'] else: keep_on_top = False if 'gr...
[ "def", "PopupError", "(", "*", "args", ",", "*", "*", "_3to2kwargs", ")", ":", "if", "'location'", "in", "_3to2kwargs", ":", "location", "=", "_3to2kwargs", "[", "'location'", "]", "del", "_3to2kwargs", "[", "'location'", "]", "else", ":", "location", "=",...
Popup with colored button and 'Error' as button text :param args: :param button_color: :param background_color: :param text_color: :param auto_close: :param auto_close_duration: :param non_blocking: :param icon: :param line_width: :param font: :param no_titlebar: :param g...
[ "Popup", "with", "colored", "button", "and", "Error", "as", "button", "text", ":", "param", "args", ":", ":", "param", "button_color", ":", ":", "param", "background_color", ":", ":", "param", "text_color", ":", ":", "param", "auto_close", ":", ":", "param...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUI27.py#L7522-L7573
train
PySimpleGUI/PySimpleGUI
PySimpleGUI27.py
TkScrollableFrame.set_scrollregion
def set_scrollregion(self, event=None): """ Set the scroll region on the canvas""" self.canvas.configure(scrollregion=self.canvas.bbox('all'))
python
def set_scrollregion(self, event=None): """ Set the scroll region on the canvas""" self.canvas.configure(scrollregion=self.canvas.bbox('all'))
[ "def", "set_scrollregion", "(", "self", ",", "event", "=", "None", ")", ":", "self", ".", "canvas", ".", "configure", "(", "scrollregion", "=", "self", ".", "canvas", ".", "bbox", "(", "'all'", ")", ")" ]
Set the scroll region on the canvas
[ "Set", "the", "scroll", "region", "on", "the", "canvas" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUI27.py#L2769-L2771
train
PySimpleGUI/PySimpleGUI
PySimpleGUI27.py
TKCalendar._show_selection
def _show_selection(self, text, bbox): """Configure canvas for a new selection.""" x, y, width, height = bbox textw = self._font.measure(text) canvas = self._canvas canvas.configure(width=width, height=height) canvas.coords(canvas.text, width - textw, height / 2 - 1) ...
python
def _show_selection(self, text, bbox): """Configure canvas for a new selection.""" x, y, width, height = bbox textw = self._font.measure(text) canvas = self._canvas canvas.configure(width=width, height=height) canvas.coords(canvas.text, width - textw, height / 2 - 1) ...
[ "def", "_show_selection", "(", "self", ",", "text", ",", "bbox", ")", ":", "x", ",", "y", ",", "width", ",", "height", "=", "bbox", "textw", "=", "self", ".", "_font", ".", "measure", "(", "text", ")", "canvas", "=", "self", ".", "_canvas", "canvas...
Configure canvas for a new selection.
[ "Configure", "canvas", "for", "a", "new", "selection", "." ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUI27.py#L3052-L3062
train
PySimpleGUI/PySimpleGUI
PySimpleGUI27.py
TKCalendar._pressed
def _pressed(self, evt): """Clicked somewhere in the calendar.""" x, y, widget = evt.x, evt.y, evt.widget item = widget.identify_row(y) column = widget.identify_column(x) if not column or not item in self._items: # clicked in the weekdays row or just outside the colu...
python
def _pressed(self, evt): """Clicked somewhere in the calendar.""" x, y, widget = evt.x, evt.y, evt.widget item = widget.identify_row(y) column = widget.identify_column(x) if not column or not item in self._items: # clicked in the weekdays row or just outside the colu...
[ "def", "_pressed", "(", "self", ",", "evt", ")", ":", "x", ",", "y", ",", "widget", "=", "evt", ".", "x", ",", "evt", ".", "y", ",", "evt", ".", "widget", "item", "=", "widget", ".", "identify_row", "(", "y", ")", "column", "=", "widget", ".", ...
Clicked somewhere in the calendar.
[ "Clicked", "somewhere", "in", "the", "calendar", "." ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUI27.py#L3066-L3102
train
PySimpleGUI/PySimpleGUI
PySimpleGUI27.py
TKCalendar._prev_month
def _prev_month(self): """Updated calendar to show the previous month.""" self._canvas.place_forget() self._date = self._date - self.timedelta(days=1) self._date = self.datetime(self._date.year, self._date.month, 1) self._build_calendar()
python
def _prev_month(self): """Updated calendar to show the previous month.""" self._canvas.place_forget() self._date = self._date - self.timedelta(days=1) self._date = self.datetime(self._date.year, self._date.month, 1) self._build_calendar()
[ "def", "_prev_month", "(", "self", ")", ":", "self", ".", "_canvas", ".", "place_forget", "(", ")", "self", ".", "_date", "=", "self", ".", "_date", "-", "self", ".", "timedelta", "(", "days", "=", "1", ")", "self", ".", "_date", "=", "self", ".", ...
Updated calendar to show the previous month.
[ "Updated", "calendar", "to", "show", "the", "previous", "month", "." ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUI27.py#L3104-L3110
train
PySimpleGUI/PySimpleGUI
PySimpleGUI27.py
TKCalendar._next_month
def _next_month(self): """Update calendar to show the next month.""" self._canvas.place_forget() year, month = self._date.year, self._date.month self._date = self._date + self.timedelta( days=calendar.monthrange(year, month)[1] + 1) self._date = self.datetime(self._d...
python
def _next_month(self): """Update calendar to show the next month.""" self._canvas.place_forget() year, month = self._date.year, self._date.month self._date = self._date + self.timedelta( days=calendar.monthrange(year, month)[1] + 1) self._date = self.datetime(self._d...
[ "def", "_next_month", "(", "self", ")", ":", "self", ".", "_canvas", ".", "place_forget", "(", ")", "year", ",", "month", "=", "self", ".", "_date", ".", "year", ",", "self", ".", "_date", ".", "month", "self", ".", "_date", "=", "self", ".", "_dat...
Update calendar to show the next month.
[ "Update", "calendar", "to", "show", "the", "next", "month", "." ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUI27.py#L3112-L3120
train
PySimpleGUI/PySimpleGUI
PySimpleGUI27.py
TKCalendar.selection
def selection(self): """Return a datetime representing the current selected date.""" if not self._selection: return None year, month = self._date.year, self._date.month return self.datetime(year, month, int(self._selection[0]))
python
def selection(self): """Return a datetime representing the current selected date.""" if not self._selection: return None year, month = self._date.year, self._date.month return self.datetime(year, month, int(self._selection[0]))
[ "def", "selection", "(", "self", ")", ":", "if", "not", "self", ".", "_selection", ":", "return", "None", "year", ",", "month", "=", "self", ".", "_date", ".", "year", ",", "self", ".", "_date", ".", "month", "return", "self", ".", "datetime", "(", ...
Return a datetime representing the current selected date.
[ "Return", "a", "datetime", "representing", "the", "current", "selected", "date", "." ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUI27.py#L3125-L3131
train
PySimpleGUI/PySimpleGUI
PySimpleGUI27.py
Window.AddRow
def AddRow(self, *args): ''' Parms are a variable number of Elements ''' NumRows = len(self.Rows) # number of existing rows is our row number CurrentRowNumber = NumRows # this row's number CurrentRow = [] # start with a blank row and build up # ------------------------- Add t...
python
def AddRow(self, *args): ''' Parms are a variable number of Elements ''' NumRows = len(self.Rows) # number of existing rows is our row number CurrentRowNumber = NumRows # this row's number CurrentRow = [] # start with a blank row and build up # ------------------------- Add t...
[ "def", "AddRow", "(", "self", ",", "*", "args", ")", ":", "NumRows", "=", "len", "(", "self", ".", "Rows", ")", "# number of existing rows is our row number", "CurrentRowNumber", "=", "NumRows", "# this row's number", "CurrentRow", "=", "[", "]", "# start with a b...
Parms are a variable number of Elements
[ "Parms", "are", "a", "variable", "number", "of", "Elements" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUI27.py#L3638-L3649
train
PySimpleGUI/PySimpleGUI
PySimpleGUI27.py
Window.SetAlpha
def SetAlpha(self, alpha): ''' Change the window's transparency :param alpha: From 0 to 1 with 0 being completely transparent :return: ''' self._AlphaChannel = alpha self.TKroot.attributes('-alpha', alpha)
python
def SetAlpha(self, alpha): ''' Change the window's transparency :param alpha: From 0 to 1 with 0 being completely transparent :return: ''' self._AlphaChannel = alpha self.TKroot.attributes('-alpha', alpha)
[ "def", "SetAlpha", "(", "self", ",", "alpha", ")", ":", "self", ".", "_AlphaChannel", "=", "alpha", "self", ".", "TKroot", ".", "attributes", "(", "'-alpha'", ",", "alpha", ")" ]
Change the window's transparency :param alpha: From 0 to 1 with 0 being completely transparent :return:
[ "Change", "the", "window", "s", "transparency", ":", "param", "alpha", ":", "From", "0", "to", "1", "with", "0", "being", "completely", "transparent", ":", "return", ":" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUI27.py#L4079-L4086
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Uno_Card_Game.py
Card.setColor
def setColor(self, color): '''Sets Card's color and escape code.''' if color == 'blue': self.color = 'blue' self.colorCode = self.colors['blue'] self.colorCodeDark = self.colors['dblue'] elif color == 'red': self.color = 'red' self.colo...
python
def setColor(self, color): '''Sets Card's color and escape code.''' if color == 'blue': self.color = 'blue' self.colorCode = self.colors['blue'] self.colorCodeDark = self.colors['dblue'] elif color == 'red': self.color = 'red' self.colo...
[ "def", "setColor", "(", "self", ",", "color", ")", ":", "if", "color", "==", "'blue'", ":", "self", ".", "color", "=", "'blue'", "self", ".", "colorCode", "=", "self", ".", "colors", "[", "'blue'", "]", "self", ".", "colorCodeDark", "=", "self", ".",...
Sets Card's color and escape code.
[ "Sets", "Card", "s", "color", "and", "escape", "code", "." ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Uno_Card_Game.py#L633-L655
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Img_Viewer.py
get_img_data
def get_img_data(f, maxsize = (1200, 850), first = False): """Generate image data using PIL """ img = Image.open(f) img.thumbnail(maxsize) if first: # tkinter is inactive the first time bio = io.BytesIO() img.save(bio, format = "PNG") del img retur...
python
def get_img_data(f, maxsize = (1200, 850), first = False): """Generate image data using PIL """ img = Image.open(f) img.thumbnail(maxsize) if first: # tkinter is inactive the first time bio = io.BytesIO() img.save(bio, format = "PNG") del img retur...
[ "def", "get_img_data", "(", "f", ",", "maxsize", "=", "(", "1200", ",", "850", ")", ",", "first", "=", "False", ")", ":", "img", "=", "Image", ".", "open", "(", "f", ")", "img", ".", "thumbnail", "(", "maxsize", ")", "if", "first", ":", "# tkinte...
Generate image data using PIL
[ "Generate", "image", "data", "using", "PIL" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Img_Viewer.py#L50-L60
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Matplotlib_Ping_Graph.py
do_one
def do_one(myStats, destIP, hostname, timeout, mySeqNumber, packet_size, quiet=False): """ Returns either the delay (in ms) or None on timeout. """ delay = None try: # One could use UDP here, but it's obscure mySocket = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.getprotobyname("...
python
def do_one(myStats, destIP, hostname, timeout, mySeqNumber, packet_size, quiet=False): """ Returns either the delay (in ms) or None on timeout. """ delay = None try: # One could use UDP here, but it's obscure mySocket = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.getprotobyname("...
[ "def", "do_one", "(", "myStats", ",", "destIP", ",", "hostname", ",", "timeout", ",", "mySeqNumber", ",", "packet_size", ",", "quiet", "=", "False", ")", ":", "delay", "=", "None", "try", ":", "# One could use UDP here, but it's obscure", "mySocket", "=", "soc...
Returns either the delay (in ms) or None on timeout.
[ "Returns", "either", "the", "delay", "(", "in", "ms", ")", "or", "None", "on", "timeout", "." ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Matplotlib_Ping_Graph.py#L315-L356
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Matplotlib_Ping_Graph.py
quiet_ping
def quiet_ping(hostname, timeout=WAIT_TIMEOUT, count=NUM_PACKETS, packet_size=PACKET_SIZE, path_finder=False): """ Same as verbose_ping, but the results are returned as tuple """ myStats = MyStats() # Reset the stats mySeqNumber = 0 # Starting value try: destIP = socket.g...
python
def quiet_ping(hostname, timeout=WAIT_TIMEOUT, count=NUM_PACKETS, packet_size=PACKET_SIZE, path_finder=False): """ Same as verbose_ping, but the results are returned as tuple """ myStats = MyStats() # Reset the stats mySeqNumber = 0 # Starting value try: destIP = socket.g...
[ "def", "quiet_ping", "(", "hostname", ",", "timeout", "=", "WAIT_TIMEOUT", ",", "count", "=", "NUM_PACKETS", ",", "packet_size", "=", "PACKET_SIZE", ",", "path_finder", "=", "False", ")", ":", "myStats", "=", "MyStats", "(", ")", "# Reset the stats", "mySeqNum...
Same as verbose_ping, but the results are returned as tuple
[ "Same", "as", "verbose_ping", "but", "the", "results", "are", "returned", "as", "tuple" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Matplotlib_Ping_Graph.py#L527-L570
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_DOC_Viewer_PIL.py
get_page
def get_page(pno, zoom = False, max_size = None, first = False): """Return a PNG image for a document page number. """ dlist = dlist_tab[pno] # get display list of page number if not dlist: # create if not yet there dlist_tab[pno] = doc[pno].getDisplayList() dlist = dlist_ta...
python
def get_page(pno, zoom = False, max_size = None, first = False): """Return a PNG image for a document page number. """ dlist = dlist_tab[pno] # get display list of page number if not dlist: # create if not yet there dlist_tab[pno] = doc[pno].getDisplayList() dlist = dlist_ta...
[ "def", "get_page", "(", "pno", ",", "zoom", "=", "False", ",", "max_size", "=", "None", ",", "first", "=", "False", ")", ":", "dlist", "=", "dlist_tab", "[", "pno", "]", "# get display list of page number", "if", "not", "dlist", ":", "# create if not yet the...
Return a PNG image for a document page number.
[ "Return", "a", "PNG", "image", "for", "a", "document", "page", "number", "." ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_DOC_Viewer_PIL.py#L75-L118
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Conways_Game_of_Life.py
GameOfLife.live_neighbours
def live_neighbours(self, i, j): """ Count the number of live neighbours around point (i, j). """ s = 0 # The total number of live neighbours. # Loop over all the neighbours. for x in [i - 1, i, i + 1]: for y in [j - 1, j, j + 1]: if (x == i and y == j): ...
python
def live_neighbours(self, i, j): """ Count the number of live neighbours around point (i, j). """ s = 0 # The total number of live neighbours. # Loop over all the neighbours. for x in [i - 1, i, i + 1]: for y in [j - 1, j, j + 1]: if (x == i and y == j): ...
[ "def", "live_neighbours", "(", "self", ",", "i", ",", "j", ")", ":", "s", "=", "0", "# The total number of live neighbours.", "# Loop over all the neighbours.", "for", "x", "in", "[", "i", "-", "1", ",", "i", ",", "i", "+", "1", "]", ":", "for", "y", "...
Count the number of live neighbours around point (i, j).
[ "Count", "the", "number", "of", "live", "neighbours", "around", "point", "(", "i", "j", ")", "." ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Conways_Game_of_Life.py#L49-L67
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Conways_Game_of_Life.py
GameOfLife.play
def play(self): """ Play Conway's Game of Life. """ # Write the initial configuration to file. self.t = 1 # Current time level while self.t <= self.T: # Evolve! # print( "At time level %d" % t) # Loop over each cell of the grid and apply Conway's rules. ...
python
def play(self): """ Play Conway's Game of Life. """ # Write the initial configuration to file. self.t = 1 # Current time level while self.t <= self.T: # Evolve! # print( "At time level %d" % t) # Loop over each cell of the grid and apply Conway's rules. ...
[ "def", "play", "(", "self", ")", ":", "# Write the initial configuration to file.", "self", ".", "t", "=", "1", "# Current time level", "while", "self", ".", "t", "<=", "self", ".", "T", ":", "# Evolve!", "# print( \"At time level %d\" % t)", "# Loop over each cell of...
Play Conway's Game of Life.
[ "Play", "Conway", "s", "Game", "of", "Life", "." ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Conways_Game_of_Life.py#L69-L97
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Desktop_Widget_psutil_Dashboard.py
human_size
def human_size(bytes, units=[' bytes','KB','MB','GB','TB', 'PB', 'EB']): """ Returns a human readable string reprentation of bytes""" return str(bytes) + units[0] if bytes < 1024 else human_size(bytes>>10, units[1:])
python
def human_size(bytes, units=[' bytes','KB','MB','GB','TB', 'PB', 'EB']): """ Returns a human readable string reprentation of bytes""" return str(bytes) + units[0] if bytes < 1024 else human_size(bytes>>10, units[1:])
[ "def", "human_size", "(", "bytes", ",", "units", "=", "[", "' bytes'", ",", "'KB'", ",", "'MB'", ",", "'GB'", ",", "'TB'", ",", "'PB'", ",", "'EB'", "]", ")", ":", "return", "str", "(", "bytes", ")", "+", "units", "[", "0", "]", "if", "bytes", ...
Returns a human readable string reprentation of bytes
[ "Returns", "a", "human", "readable", "string", "reprentation", "of", "bytes" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Desktop_Widget_psutil_Dashboard.py#L51-L53
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWeb/Demo Programs/Web_Demo_HowDoI.py
HowDoI
def HowDoI(): ''' Make and show a window (PySimpleGUI form) that takes user input and sends to the HowDoI web oracle Excellent example of 2 GUI concepts 1. Output Element that will show text in a scrolled window 2. Non-Window-Closing Buttons - These buttons will cause the form to return with...
python
def HowDoI(): ''' Make and show a window (PySimpleGUI form) that takes user input and sends to the HowDoI web oracle Excellent example of 2 GUI concepts 1. Output Element that will show text in a scrolled window 2. Non-Window-Closing Buttons - These buttons will cause the form to return with...
[ "def", "HowDoI", "(", ")", ":", "# ------- Make a new Window ------- #", "sg", ".", "ChangeLookAndFeel", "(", "'GreenTan'", ")", "# give our form a spiffy set of colors", "layout", "=", "[", "[", "sg", ".", "Text", "(", "'Ask and your answer will appear here....'", ",",...
Make and show a window (PySimpleGUI form) that takes user input and sends to the HowDoI web oracle Excellent example of 2 GUI concepts 1. Output Element that will show text in a scrolled window 2. Non-Window-Closing Buttons - These buttons will cause the form to return with the form's values, but do...
[ "Make", "and", "show", "a", "window", "(", "PySimpleGUI", "form", ")", "that", "takes", "user", "input", "and", "sends", "to", "the", "HowDoI", "web", "oracle", "Excellent", "example", "of", "2", "GUI", "concepts", "1", ".", "Output", "Element", "that", ...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWeb/Demo Programs/Web_Demo_HowDoI.py#L14-L68
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWeb/Demo Programs/Web_Demo_HowDoI.py
QueryHowDoI
def QueryHowDoI(Query, num_answers, full_text, window:sg.Window): ''' Kicks off a subprocess to send the 'Query' to HowDoI Prints the result, which in this program will route to a gooeyGUI window :param Query: text english question to ask the HowDoI web engine :return: nothing ''' howdoi_com...
python
def QueryHowDoI(Query, num_answers, full_text, window:sg.Window): ''' Kicks off a subprocess to send the 'Query' to HowDoI Prints the result, which in this program will route to a gooeyGUI window :param Query: text english question to ask the HowDoI web engine :return: nothing ''' howdoi_com...
[ "def", "QueryHowDoI", "(", "Query", ",", "num_answers", ",", "full_text", ",", "window", ":", "sg", ".", "Window", ")", ":", "howdoi_command", "=", "HOW_DO_I_COMMAND", "full_text_option", "=", "' -a'", "if", "full_text", "else", "''", "t", "=", "subprocess", ...
Kicks off a subprocess to send the 'Query' to HowDoI Prints the result, which in this program will route to a gooeyGUI window :param Query: text english question to ask the HowDoI web engine :return: nothing
[ "Kicks", "off", "a", "subprocess", "to", "send", "the", "Query", "to", "HowDoI", "Prints", "the", "result", "which", "in", "this", "program", "will", "route", "to", "a", "gooeyGUI", "window", ":", "param", "Query", ":", "text", "english", "question", "to",...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWeb/Demo Programs/Web_Demo_HowDoI.py#L70-L84
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWeb/Demo Programs/widgets_overview_app.py
MyApp.list_view_on_selected
def list_view_on_selected(self, widget, selected_item_key): """ The selection event of the listView, returns a key of the clicked event. You can retrieve the item rapidly """ self.lbl.set_text('List selection: ' + self.listView.children[selected_item_key].get_text())
python
def list_view_on_selected(self, widget, selected_item_key): """ The selection event of the listView, returns a key of the clicked event. You can retrieve the item rapidly """ self.lbl.set_text('List selection: ' + self.listView.children[selected_item_key].get_text())
[ "def", "list_view_on_selected", "(", "self", ",", "widget", ",", "selected_item_key", ")", ":", "self", ".", "lbl", ".", "set_text", "(", "'List selection: '", "+", "self", ".", "listView", ".", "children", "[", "selected_item_key", "]", ".", "get_text", "(", ...
The selection event of the listView, returns a key of the clicked event. You can retrieve the item rapidly
[ "The", "selection", "event", "of", "the", "listView", "returns", "a", "key", "of", "the", "clicked", "event", ".", "You", "can", "retrieve", "the", "item", "rapidly" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWeb/Demo Programs/widgets_overview_app.py#L281-L285
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Matplotlib_Browser_Paned.py
PyplotHistogram
def PyplotHistogram(): """ ============================================================= Demo of the histogram (hist) function with multiple data sets ============================================================= Plot histogram with multiple sample sets and demonstrate: * Use of legend wit...
python
def PyplotHistogram(): """ ============================================================= Demo of the histogram (hist) function with multiple data sets ============================================================= Plot histogram with multiple sample sets and demonstrate: * Use of legend wit...
[ "def", "PyplotHistogram", "(", ")", ":", "import", "numpy", "as", "np", "import", "matplotlib", ".", "pyplot", "as", "plt", "np", ".", "random", ".", "seed", "(", "0", ")", "n_bins", "=", "10", "x", "=", "np", ".", "random", ".", "randn", "(", "100...
============================================================= Demo of the histogram (hist) function with multiple data sets ============================================================= Plot histogram with multiple sample sets and demonstrate: * Use of legend with multiple sample sets * St...
[ "=============================================================", "Demo", "of", "the", "histogram", "(", "hist", ")", "function", "with", "multiple", "data", "sets", "=============================================================" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Matplotlib_Browser_Paned.py#L44-L91
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Matplotlib_Browser_Paned.py
PyplotArtistBoxPlots
def PyplotArtistBoxPlots(): """ ========================================= Demo of artist customization in box plots ========================================= This example demonstrates how to use the various kwargs to fully customize box plots. The first figure demonstrates how to remove and...
python
def PyplotArtistBoxPlots(): """ ========================================= Demo of artist customization in box plots ========================================= This example demonstrates how to use the various kwargs to fully customize box plots. The first figure demonstrates how to remove and...
[ "def", "PyplotArtistBoxPlots", "(", ")", ":", "import", "numpy", "as", "np", "import", "matplotlib", ".", "pyplot", "as", "plt", "# fake data", "np", ".", "random", ".", "seed", "(", "937", ")", "data", "=", "np", ".", "random", ".", "lognormal", "(", ...
========================================= Demo of artist customization in box plots ========================================= This example demonstrates how to use the various kwargs to fully customize box plots. The first figure demonstrates how to remove and add individual components (note that th...
[ "=========================================", "Demo", "of", "artist", "customization", "in", "box", "plots", "=========================================" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Matplotlib_Browser_Paned.py#L93-L147
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Matplotlib_Browser_Paned.py
PyplotLineStyles
def PyplotLineStyles(): """ ========== Linestyles ========== This examples showcases different linestyles copying those of Tikz/PGF. """ import numpy as np import matplotlib.pyplot as plt from collections import OrderedDict from matplotlib.transforms import blended_transform_fac...
python
def PyplotLineStyles(): """ ========== Linestyles ========== This examples showcases different linestyles copying those of Tikz/PGF. """ import numpy as np import matplotlib.pyplot as plt from collections import OrderedDict from matplotlib.transforms import blended_transform_fac...
[ "def", "PyplotLineStyles", "(", ")", ":", "import", "numpy", "as", "np", "import", "matplotlib", ".", "pyplot", "as", "plt", "from", "collections", "import", "OrderedDict", "from", "matplotlib", ".", "transforms", "import", "blended_transform_factory", "linestyles",...
========== Linestyles ========== This examples showcases different linestyles copying those of Tikz/PGF.
[ "==========", "Linestyles", "==========" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Matplotlib_Browser_Paned.py#L211-L262
train
PySimpleGUI/PySimpleGUI
PySimpleGUIQt/PySimpleGUIQt.py
convert_tkinter_size_to_Qt
def convert_tkinter_size_to_Qt(size): """ Converts size in characters to size in pixels :param size: size in characters, rows :return: size in pixels, pixels """ qtsize = size if size[1] is not None and size[1] < DEFAULT_PIXEL_TO_CHARS_CUTOFF: # change from character based size to pi...
python
def convert_tkinter_size_to_Qt(size): """ Converts size in characters to size in pixels :param size: size in characters, rows :return: size in pixels, pixels """ qtsize = size if size[1] is not None and size[1] < DEFAULT_PIXEL_TO_CHARS_CUTOFF: # change from character based size to pi...
[ "def", "convert_tkinter_size_to_Qt", "(", "size", ")", ":", "qtsize", "=", "size", "if", "size", "[", "1", "]", "is", "not", "None", "and", "size", "[", "1", "]", "<", "DEFAULT_PIXEL_TO_CHARS_CUTOFF", ":", "# change from character based size to pixels (roughly)", ...
Converts size in characters to size in pixels :param size: size in characters, rows :return: size in pixels, pixels
[ "Converts", "size", "in", "characters", "to", "size", "in", "pixels", ":", "param", "size", ":", "size", "in", "characters", "rows", ":", "return", ":", "size", "in", "pixels", "pixels" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIQt/PySimpleGUIQt.py#L3730-L3739
train
PySimpleGUI/PySimpleGUI
PySimpleGUIQt/PySimpleGUIQt.py
create_style_from_font
def create_style_from_font(font): """ Convert from font string/tyuple into a Qt style sheet string :param font: "Arial 10 Bold" or ('Arial', 10, 'Bold) :return: style string that can be combined with other style strings """ if font is None: return '' if type(font) is str: _...
python
def create_style_from_font(font): """ Convert from font string/tyuple into a Qt style sheet string :param font: "Arial 10 Bold" or ('Arial', 10, 'Bold) :return: style string that can be combined with other style strings """ if font is None: return '' if type(font) is str: _...
[ "def", "create_style_from_font", "(", "font", ")", ":", "if", "font", "is", "None", ":", "return", "''", "if", "type", "(", "font", ")", "is", "str", ":", "_font", "=", "font", ".", "split", "(", "' '", ")", "else", ":", "_font", "=", "font", "styl...
Convert from font string/tyuple into a Qt style sheet string :param font: "Arial 10 Bold" or ('Arial', 10, 'Bold) :return: style string that can be combined with other style strings
[ "Convert", "from", "font", "string", "/", "tyuple", "into", "a", "Qt", "style", "sheet", "string", ":", "param", "font", ":", "Arial", "10", "Bold", "or", "(", "Arial", "10", "Bold", ")", ":", "return", ":", "style", "string", "that", "can", "be", "c...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIQt/PySimpleGUIQt.py#L3756-L3782
train
PySimpleGUI/PySimpleGUI
PySimpleGUIQt/PySimpleGUIQt.py
PopupGetFolder
def PopupGetFolder(message, title=None, default_path='', no_window=False, size=(None, None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None, None), initial_fol...
python
def PopupGetFolder(message, title=None, default_path='', no_window=False, size=(None, None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None, None), initial_fol...
[ "def", "PopupGetFolder", "(", "message", ",", "title", "=", "None", ",", "default_path", "=", "''", ",", "no_window", "=", "False", ",", "size", "=", "(", "None", ",", "None", ")", ",", "button_color", "=", "None", ",", "background_color", "=", "None", ...
Display popup with text entry field and browse button. Browse for folder :param message: :param default_path: :param no_window: :param size: :param button_color: :param background_color: :param text_color: :param icon: :param font: :param no_titlebar: :param grab_anywhere: ...
[ "Display", "popup", "with", "text", "entry", "field", "and", "browse", "button", ".", "Browse", "for", "folder", ":", "param", "message", ":", ":", "param", "default_path", ":", ":", "param", "no_window", ":", ":", "param", "size", ":", ":", "param", "bu...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIQt/PySimpleGUIQt.py#L7025-L7070
train
PySimpleGUI/PySimpleGUI
PySimpleGUIQt/PySimpleGUIQt.py
PopupGetFile
def PopupGetFile(message, title=None, default_path='', default_extension='', save_as=False, file_types=(("ALL Files", "*"),), no_window=False, size=(None, None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anyw...
python
def PopupGetFile(message, title=None, default_path='', default_extension='', save_as=False, file_types=(("ALL Files", "*"),), no_window=False, size=(None, None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anyw...
[ "def", "PopupGetFile", "(", "message", ",", "title", "=", "None", ",", "default_path", "=", "''", ",", "default_extension", "=", "''", ",", "save_as", "=", "False", ",", "file_types", "=", "(", "(", "\"ALL Files\"", ",", "\"*\"", ")", ",", ")", ",", "n...
Display popup with text entry field and browse button. Browse for file :param message: :param default_path: :param default_extension: :param save_as: :param file_types: :param no_window: :param size: :param button_color: :param background_color: :param text_color: :param icon...
[ "Display", "popup", "with", "text", "entry", "field", "and", "browse", "button", ".", "Browse", "for", "file", ":", "param", "message", ":", ":", "param", "default_path", ":", ":", "param", "default_extension", ":", ":", "param", "save_as", ":", ":", "para...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIQt/PySimpleGUIQt.py#L7075-L7132
train
PySimpleGUI/PySimpleGUI
PySimpleGUIQt/PySimpleGUIQt.py
PopupGetText
def PopupGetText(message, title=None, default_text='', password_char='', size=(None, None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None, None)): """ Dis...
python
def PopupGetText(message, title=None, default_text='', password_char='', size=(None, None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None, None)): """ Dis...
[ "def", "PopupGetText", "(", "message", ",", "title", "=", "None", ",", "default_text", "=", "''", ",", "password_char", "=", "''", ",", "size", "=", "(", "None", ",", "None", ")", ",", "button_color", "=", "None", ",", "background_color", "=", "None", ...
Display Popup with text entry field :param message: :param default_text: :param password_char: :param size: :param button_color: :param background_color: :param text_color: :param icon: :param font: :param no_titlebar: :param grab_anywhere: :param keep_on_top: :param ...
[ "Display", "Popup", "with", "text", "entry", "field", ":", "param", "message", ":", ":", "param", "default_text", ":", ":", "param", "password_char", ":", ":", "param", "size", ":", ":", "param", "button_color", ":", ":", "param", "background_color", ":", ...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIQt/PySimpleGUIQt.py#L7137-L7173
train
PySimpleGUI/PySimpleGUI
PySimpleGUIQt/PySimpleGUIQt.py
SystemTray.Read
def Read(self, timeout=None): ''' Reads the context menu :param timeout: Optional. Any value other than None indicates a non-blocking read :return: ''' if not self.Shown: self.Shown = True self.TrayIcon.show() if timeout is None: ...
python
def Read(self, timeout=None): ''' Reads the context menu :param timeout: Optional. Any value other than None indicates a non-blocking read :return: ''' if not self.Shown: self.Shown = True self.TrayIcon.show() if timeout is None: ...
[ "def", "Read", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "not", "self", ".", "Shown", ":", "self", ".", "Shown", "=", "True", "self", ".", "TrayIcon", ".", "show", "(", ")", "if", "timeout", "is", "None", ":", "self", ".", "App", ...
Reads the context menu :param timeout: Optional. Any value other than None indicates a non-blocking read :return:
[ "Reads", "the", "context", "menu", ":", "param", "timeout", ":", "Optional", ".", "Any", "value", "other", "than", "None", "indicates", "a", "non", "-", "blocking", "read", ":", "return", ":" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIQt/PySimpleGUIQt.py#L2953-L2975
train
PySimpleGUI/PySimpleGUI
PySimpleGUIQt/PySimpleGUIQt.py
SystemTray.ShowMessage
def ShowMessage(self, title, message, filename=None, data=None, data_base64=None, messageicon=None, time=10000): ''' Shows a balloon above icon in system tray :param title: Title shown in balloon :param message: Message to be displayed :param filename: Optional icon filename ...
python
def ShowMessage(self, title, message, filename=None, data=None, data_base64=None, messageicon=None, time=10000): ''' Shows a balloon above icon in system tray :param title: Title shown in balloon :param message: Message to be displayed :param filename: Optional icon filename ...
[ "def", "ShowMessage", "(", "self", ",", "title", ",", "message", ",", "filename", "=", "None", ",", "data", "=", "None", ",", "data_base64", "=", "None", ",", "messageicon", "=", "None", ",", "time", "=", "10000", ")", ":", "qicon", "=", "None", "if"...
Shows a balloon above icon in system tray :param title: Title shown in balloon :param message: Message to be displayed :param filename: Optional icon filename :param data: Optional in-ram icon :param data_base64: Optional base64 icon :param time: How long to display mess...
[ "Shows", "a", "balloon", "above", "icon", "in", "system", "tray", ":", "param", "title", ":", "Title", "shown", "in", "balloon", ":", "param", "message", ":", "Message", "to", "be", "displayed", ":", "param", "filename", ":", "Optional", "icon", "filename"...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIQt/PySimpleGUIQt.py#L2988-L3022
train
PySimpleGUI/PySimpleGUI
PySimpleGUIQt/PySimpleGUIQt.py
SystemTray.Update
def Update(self, menu=None, tooltip=None,filename=None, data=None, data_base64=None,): ''' Updates the menu, tooltip or icon :param menu: menu defintion :param tooltip: string representing tooltip :param filename: icon filename :param data: icon raw image :param...
python
def Update(self, menu=None, tooltip=None,filename=None, data=None, data_base64=None,): ''' Updates the menu, tooltip or icon :param menu: menu defintion :param tooltip: string representing tooltip :param filename: icon filename :param data: icon raw image :param...
[ "def", "Update", "(", "self", ",", "menu", "=", "None", ",", "tooltip", "=", "None", ",", "filename", "=", "None", ",", "data", "=", "None", ",", "data_base64", "=", "None", ",", ")", ":", "# Menu", "if", "menu", "is", "not", "None", ":", "self", ...
Updates the menu, tooltip or icon :param menu: menu defintion :param tooltip: string representing tooltip :param filename: icon filename :param data: icon raw image :param data_base64: icon base 64 image :return:
[ "Updates", "the", "menu", "tooltip", "or", "icon", ":", "param", "menu", ":", "menu", "defintion", ":", "param", "tooltip", ":", "string", "representing", "tooltip", ":", "param", "filename", ":", "icon", "filename", ":", "param", "data", ":", "icon", "raw...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIQt/PySimpleGUIQt.py#L3034-L3069
train
PySimpleGUI/PySimpleGUI
PySimpleGUIQt/PySimpleGUIQt.py
Window.SetAlpha
def SetAlpha(self, alpha): ''' Change the window's transparency :param alpha: From 0 to 1 with 0 being completely transparent :return: ''' self._AlphaChannel = alpha if self._AlphaChannel is not None: self.QT_QMainWindow.setWindowOpacity(self._AlphaCha...
python
def SetAlpha(self, alpha): ''' Change the window's transparency :param alpha: From 0 to 1 with 0 being completely transparent :return: ''' self._AlphaChannel = alpha if self._AlphaChannel is not None: self.QT_QMainWindow.setWindowOpacity(self._AlphaCha...
[ "def", "SetAlpha", "(", "self", ",", "alpha", ")", ":", "self", ".", "_AlphaChannel", "=", "alpha", "if", "self", ".", "_AlphaChannel", "is", "not", "None", ":", "self", ".", "QT_QMainWindow", ".", "setWindowOpacity", "(", "self", ".", "_AlphaChannel", ")"...
Change the window's transparency :param alpha: From 0 to 1 with 0 being completely transparent :return:
[ "Change", "the", "window", "s", "transparency", ":", "param", "alpha", ":", "From", "0", "to", "1", "with", "0", "being", "completely", "transparent", ":", "return", ":" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIQt/PySimpleGUIQt.py#L3576-L3584
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWx/PySimpleGUIWx.py
convert_tkinter_size_to_Wx
def convert_tkinter_size_to_Wx(size): """ Converts size in characters to size in pixels :param size: size in characters, rows :return: size in pixels, pixels """ qtsize = size if size[1] is not None and size[1] < DEFAULT_PIXEL_TO_CHARS_CUTOFF: # change from character based size to pi...
python
def convert_tkinter_size_to_Wx(size): """ Converts size in characters to size in pixels :param size: size in characters, rows :return: size in pixels, pixels """ qtsize = size if size[1] is not None and size[1] < DEFAULT_PIXEL_TO_CHARS_CUTOFF: # change from character based size to pi...
[ "def", "convert_tkinter_size_to_Wx", "(", "size", ")", ":", "qtsize", "=", "size", "if", "size", "[", "1", "]", "is", "not", "None", "and", "size", "[", "1", "]", "<", "DEFAULT_PIXEL_TO_CHARS_CUTOFF", ":", "# change from character based size to pixels (roughly)", ...
Converts size in characters to size in pixels :param size: size in characters, rows :return: size in pixels, pixels
[ "Converts", "size", "in", "characters", "to", "size", "in", "pixels", ":", "param", "size", ":", "size", "in", "characters", "rows", ":", "return", ":", "size", "in", "pixels", "pixels" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWx/PySimpleGUIWx.py#L3570-L3579
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWx/PySimpleGUIWx.py
font_to_wx_font
def font_to_wx_font(font): """ Convert from font string/tyuple into a Qt style sheet string :param font: "Arial 10 Bold" or ('Arial', 10, 'Bold) :return: style string that can be combined with other style strings """ if font is None: return '' if type(font) is str: _font = ...
python
def font_to_wx_font(font): """ Convert from font string/tyuple into a Qt style sheet string :param font: "Arial 10 Bold" or ('Arial', 10, 'Bold) :return: style string that can be combined with other style strings """ if font is None: return '' if type(font) is str: _font = ...
[ "def", "font_to_wx_font", "(", "font", ")", ":", "if", "font", "is", "None", ":", "return", "''", "if", "type", "(", "font", ")", "is", "str", ":", "_font", "=", "font", ".", "split", "(", "' '", ")", "else", ":", "_font", "=", "font", "name", "=...
Convert from font string/tyuple into a Qt style sheet string :param font: "Arial 10 Bold" or ('Arial', 10, 'Bold) :return: style string that can be combined with other style strings
[ "Convert", "from", "font", "string", "/", "tyuple", "into", "a", "Qt", "style", "sheet", "string", ":", "param", "font", ":", "Arial", "10", "Bold", "or", "(", "Arial", "10", "Bold", ")", ":", "return", ":", "style", "string", "that", "can", "be", "c...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWx/PySimpleGUIWx.py#L3582-L3612
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWx/PySimpleGUIWx.py
PopupError
def PopupError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(...
python
def PopupError(*args, button_color=DEFAULT_ERROR_BUTTON_COLOR, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(...
[ "def", "PopupError", "(", "*", "args", ",", "button_color", "=", "DEFAULT_ERROR_BUTTON_COLOR", ",", "background_color", "=", "None", ",", "text_color", "=", "None", ",", "auto_close", "=", "False", ",", "auto_close_duration", "=", "None", ",", "non_blocking", "=...
Popup with colored button and 'Error' as button text :param args: :param button_color: :param background_color: :param text_color: :param auto_close: :param auto_close_duration: :param non_blocking: :param icon: :param line_width: :param font: :param no_titlebar: :param g...
[ "Popup", "with", "colored", "button", "and", "Error", "as", "button", "text", ":", "param", "args", ":", ":", "param", "button_color", ":", ":", "param", "background_color", ":", ":", "param", "text_color", ":", ":", "param", "auto_close", ":", ":", "param...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWx/PySimpleGUIWx.py#L6621-L6645
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWx/PySimpleGUIWx.py
PopupGetFolder
def PopupGetFolder(message, title=None, default_path='', no_window=False, size=(None, None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None, None), initial_fol...
python
def PopupGetFolder(message, title=None, default_path='', no_window=False, size=(None, None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None, None), initial_fol...
[ "def", "PopupGetFolder", "(", "message", ",", "title", "=", "None", ",", "default_path", "=", "''", ",", "no_window", "=", "False", ",", "size", "=", "(", "None", ",", "None", ")", ",", "button_color", "=", "None", ",", "background_color", "=", "None", ...
Display popup with text entry field and browse button. Browse for folder :param message: :param default_path: :param no_window: :param size: :param button_color: :param background_color: :param text_color: :param icon: :param font: :param no_titlebar: :param grab_anywhere: ...
[ "Display", "popup", "with", "text", "entry", "field", "and", "browse", "button", ".", "Browse", "for", "folder", ":", "param", "message", ":", ":", "param", "default_path", ":", ":", "param", "no_window", ":", ":", "param", "size", ":", ":", "param", "bu...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWx/PySimpleGUIWx.py#L6768-L6821
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWx/PySimpleGUIWx.py
PopupGetFile
def PopupGetFile(message, title=None, default_path='', default_extension='', save_as=False, file_types=(("ALL Files", "*"),), no_window=False, size=(None, None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anyw...
python
def PopupGetFile(message, title=None, default_path='', default_extension='', save_as=False, file_types=(("ALL Files", "*"),), no_window=False, size=(None, None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anyw...
[ "def", "PopupGetFile", "(", "message", ",", "title", "=", "None", ",", "default_path", "=", "''", ",", "default_extension", "=", "''", ",", "save_as", "=", "False", ",", "file_types", "=", "(", "(", "\"ALL Files\"", ",", "\"*\"", ")", ",", ")", ",", "n...
Display popup with text entry field and browse button. Browse for file :param message: :param default_path: :param default_extension: :param save_as: :param file_types: :param no_window: :param size: :param button_color: :param background_color: :param text_color: :param icon...
[ "Display", "popup", "with", "text", "entry", "field", "and", "browse", "button", ".", "Browse", "for", "file", ":", "param", "message", ":", ":", "param", "default_path", ":", ":", "param", "default_extension", ":", ":", "param", "save_as", ":", ":", "para...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWx/PySimpleGUIWx.py#L6826-L6888
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWx/PySimpleGUIWx.py
SystemTray.Read
def Read(self, timeout=None): ''' Reads the context menu :param timeout: Optional. Any value other than None indicates a non-blocking read :return: ''' # if not self.Shown: # self.Shown = True # self.TrayIcon.show() timeout1 = timeout ...
python
def Read(self, timeout=None): ''' Reads the context menu :param timeout: Optional. Any value other than None indicates a non-blocking read :return: ''' # if not self.Shown: # self.Shown = True # self.TrayIcon.show() timeout1 = timeout ...
[ "def", "Read", "(", "self", ",", "timeout", "=", "None", ")", ":", "# if not self.Shown:", "# self.Shown = True", "# self.TrayIcon.show()", "timeout1", "=", "timeout", "# if timeout1 == 0:", "# timeout1 = 1", "# if wx.GetApp():", "# wx.GetApp().ProcessPendingEve...
Reads the context menu :param timeout: Optional. Any value other than None indicates a non-blocking read :return:
[ "Reads", "the", "context", "menu", ":", "param", "timeout", ":", "Optional", ".", "Any", "value", "other", "than", "None", "indicates", "a", "non", "-", "blocking", "read", ":", "return", ":" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWx/PySimpleGUIWx.py#L2817-L2847
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWx/PySimpleGUIWx.py
SystemTray.ShowMessage
def ShowMessage(self, title, message, filename=None, data=None, data_base64=None, messageicon=None, time=10000): ''' Shows a balloon above icon in system tray :param title: Title shown in balloon :param message: Message to be displayed :param filename: Optional icon filename ...
python
def ShowMessage(self, title, message, filename=None, data=None, data_base64=None, messageicon=None, time=10000): ''' Shows a balloon above icon in system tray :param title: Title shown in balloon :param message: Message to be displayed :param filename: Optional icon filename ...
[ "def", "ShowMessage", "(", "self", ",", "title", ",", "message", ",", "filename", "=", "None", ",", "data", "=", "None", ",", "data_base64", "=", "None", ",", "messageicon", "=", "None", ",", "time", "=", "10000", ")", ":", "if", "messageicon", "is", ...
Shows a balloon above icon in system tray :param title: Title shown in balloon :param message: Message to be displayed :param filename: Optional icon filename :param data: Optional in-ram icon :param data_base64: Optional base64 icon :param time: How long to display mess...
[ "Shows", "a", "balloon", "above", "icon", "in", "system", "tray", ":", "param", "title", ":", "Title", "shown", "in", "balloon", ":", "param", "message", ":", "Message", "to", "be", "displayed", ":", "param", "filename", ":", "Optional", "icon", "filename"...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWx/PySimpleGUIWx.py#L2863-L2879
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWx/PySimpleGUIWx.py
SystemTray.Update
def Update(self, menu=None, tooltip=None,filename=None, data=None, data_base64=None,): ''' Updates the menu, tooltip or icon :param menu: menu defintion :param tooltip: string representing tooltip :param filename: icon filename :param data: icon raw image :param...
python
def Update(self, menu=None, tooltip=None,filename=None, data=None, data_base64=None,): ''' Updates the menu, tooltip or icon :param menu: menu defintion :param tooltip: string representing tooltip :param filename: icon filename :param data: icon raw image :param...
[ "def", "Update", "(", "self", ",", "menu", "=", "None", ",", "tooltip", "=", "None", ",", "filename", "=", "None", ",", "data", "=", "None", ",", "data_base64", "=", "None", ",", ")", ":", "# Menu", "if", "menu", "is", "not", "None", ":", "self", ...
Updates the menu, tooltip or icon :param menu: menu defintion :param tooltip: string representing tooltip :param filename: icon filename :param data: icon raw image :param data_base64: icon base 64 image :return:
[ "Updates", "the", "menu", "tooltip", "or", "icon", ":", "param", "menu", ":", "menu", "defintion", ":", "param", "tooltip", ":", "string", "representing", "tooltip", ":", "param", "filename", ":", "icon", "filename", ":", "param", "data", ":", "icon", "raw...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWx/PySimpleGUIWx.py#L2894-L2915
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWx/PySimpleGUIWx.py
DragFrame.on_mouse
def on_mouse(self, event): ''' implement dragging ''' # print('on_mouse') if not event.Dragging(): self._dragPos = None return # self.CaptureMouse() if not self._dragPos: self._dragPos = event.GetPosition() else: ...
python
def on_mouse(self, event): ''' implement dragging ''' # print('on_mouse') if not event.Dragging(): self._dragPos = None return # self.CaptureMouse() if not self._dragPos: self._dragPos = event.GetPosition() else: ...
[ "def", "on_mouse", "(", "self", ",", "event", ")", ":", "# print('on_mouse')", "if", "not", "event", ".", "Dragging", "(", ")", ":", "self", ".", "_dragPos", "=", "None", "return", "# self.CaptureMouse()", "if", "not", "self", ".", "_dragPos", ":", "self",...
implement dragging
[ "implement", "dragging" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWx/PySimpleGUIWx.py#L2947-L2961
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWx/PySimpleGUIWx.py
Window.SetAlpha
def SetAlpha(self, alpha): ''' Change the window's transparency :param alpha: From 0 to 1 with 0 being completely transparent :return: ''' self._AlphaChannel = alpha * 255 if self._AlphaChannel is not None: self.MasterFrame.SetTransparent(self._AlphaCh...
python
def SetAlpha(self, alpha): ''' Change the window's transparency :param alpha: From 0 to 1 with 0 being completely transparent :return: ''' self._AlphaChannel = alpha * 255 if self._AlphaChannel is not None: self.MasterFrame.SetTransparent(self._AlphaCh...
[ "def", "SetAlpha", "(", "self", ",", "alpha", ")", ":", "self", ".", "_AlphaChannel", "=", "alpha", "*", "255", "if", "self", ".", "_AlphaChannel", "is", "not", "None", ":", "self", ".", "MasterFrame", ".", "SetTransparent", "(", "self", ".", "_AlphaChan...
Change the window's transparency :param alpha: From 0 to 1 with 0 being completely transparent :return:
[ "Change", "the", "window", "s", "transparency", ":", "param", "alpha", ":", "From", "0", "to", "1", "with", "0", "being", "completely", "transparent", ":", "return", ":" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWx/PySimpleGUIWx.py#L3460-L3468
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Multithreaded_Queued.py
worker_thread
def worker_thread(thread_name, run_freq, gui_queue): """ A worker thrread that communicates with the GUI These threads can call functions that block withouth affecting the GUI (a good thing) Note that this function is the code started as each thread. All threads are identical in this way :param thr...
python
def worker_thread(thread_name, run_freq, gui_queue): """ A worker thrread that communicates with the GUI These threads can call functions that block withouth affecting the GUI (a good thing) Note that this function is the code started as each thread. All threads are identical in this way :param thr...
[ "def", "worker_thread", "(", "thread_name", ",", "run_freq", ",", "gui_queue", ")", ":", "print", "(", "'Starting thread - {} that runds every {} ms'", ".", "format", "(", "thread_name", ",", "run_freq", ")", ")", "for", "i", "in", "itertools", ".", "count", "("...
A worker thrread that communicates with the GUI These threads can call functions that block withouth affecting the GUI (a good thing) Note that this function is the code started as each thread. All threads are identical in this way :param thread_name: Text name used for displaying info :param run_freq:...
[ "A", "worker", "thrread", "that", "communicates", "with", "the", "GUI", "These", "threads", "can", "call", "functions", "that", "block", "withouth", "affecting", "the", "GUI", "(", "a", "good", "thing", ")", "Note", "that", "this", "function", "is", "the", ...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Multithreaded_Queued.py#L44-L58
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Multithreaded_Queued.py
the_gui
def the_gui(gui_queue): """ Starts and executes the GUI Reads data from a Queue and displays the data to the window Returns when the user exits / closes the window (that means it does NOT return until the user exits the window) :param gui_queue: Queue the GUI should read from :return: ...
python
def the_gui(gui_queue): """ Starts and executes the GUI Reads data from a Queue and displays the data to the window Returns when the user exits / closes the window (that means it does NOT return until the user exits the window) :param gui_queue: Queue the GUI should read from :return: ...
[ "def", "the_gui", "(", "gui_queue", ")", ":", "layout", "=", "[", "[", "sg", ".", "Text", "(", "'Multithreaded Window Example'", ")", "]", ",", "[", "sg", ".", "Text", "(", "''", ",", "size", "=", "(", "15", ",", "1", ")", ",", "key", "=", "'_OUT...
Starts and executes the GUI Reads data from a Queue and displays the data to the window Returns when the user exits / closes the window (that means it does NOT return until the user exits the window) :param gui_queue: Queue the GUI should read from :return:
[ "Starts", "and", "executes", "the", "GUI", "Reads", "data", "from", "a", "Queue", "and", "displays", "the", "data", "to", "the", "window", "Returns", "when", "the", "user", "exits", "/", "closes", "the", "window", "(", "that", "means", "it", "does", "NOT...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Multithreaded_Queued.py#L68-L100
train
PySimpleGUI/PySimpleGUI
DemoPrograms/ping.py
send_one_ping
def send_one_ping(mySocket, destIP, myID, mySeqNumber, packet_size): """ Send one ping to the given >destIP<. """ #destIP = socket.gethostbyname(destIP) # Header is type (8), code (8), checksum (16), id (16), sequence (16) # (packet_size - 8) - Remove header size from packet size myChecks...
python
def send_one_ping(mySocket, destIP, myID, mySeqNumber, packet_size): """ Send one ping to the given >destIP<. """ #destIP = socket.gethostbyname(destIP) # Header is type (8), code (8), checksum (16), id (16), sequence (16) # (packet_size - 8) - Remove header size from packet size myChecks...
[ "def", "send_one_ping", "(", "mySocket", ",", "destIP", ",", "myID", ",", "mySeqNumber", ",", "packet_size", ")", ":", "#destIP = socket.gethostbyname(destIP)", "# Header is type (8), code (8), checksum (16), id (16), sequence (16)", "# (packet_size - 8) - Remove header size from p...
Send one ping to the given >destIP<.
[ "Send", "one", "ping", "to", "the", "given", ">", "destIP<", "." ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/ping.py#L337-L387
train
PySimpleGUI/PySimpleGUI
DemoPrograms/ping.py
receive_one_ping
def receive_one_ping(mySocket, myID, timeout): """ Receive the ping from the socket. Timeout = in ms """ timeLeft = timeout/1000 while True: # Loop while waiting for packet or timeout startedSelect = default_timer() whatReady = select.select([mySocket], [], [], timeLeft) how...
python
def receive_one_ping(mySocket, myID, timeout): """ Receive the ping from the socket. Timeout = in ms """ timeLeft = timeout/1000 while True: # Loop while waiting for packet or timeout startedSelect = default_timer() whatReady = select.select([mySocket], [], [], timeLeft) how...
[ "def", "receive_one_ping", "(", "mySocket", ",", "myID", ",", "timeout", ")", ":", "timeLeft", "=", "timeout", "/", "1000", "while", "True", ":", "# Loop while waiting for packet or timeout", "startedSelect", "=", "default_timer", "(", ")", "whatReady", "=", "sele...
Receive the ping from the socket. Timeout = in ms
[ "Receive", "the", "ping", "from", "the", "socket", ".", "Timeout", "=", "in", "ms" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/ping.py#L390-L427
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Script_Launcher_Realtime_Output.py
runCommand
def runCommand(cmd, timeout=None, window=None): """ run shell command @param cmd: command to execute @param timeout: timeout for command execution @param window: the PySimpleGUI window that the output is going to (needed to do refresh on) @return: (return code from command, command output) """ p = subproce...
python
def runCommand(cmd, timeout=None, window=None): """ run shell command @param cmd: command to execute @param timeout: timeout for command execution @param window: the PySimpleGUI window that the output is going to (needed to do refresh on) @return: (return code from command, command output) """ p = subproce...
[ "def", "runCommand", "(", "cmd", ",", "timeout", "=", "None", ",", "window", "=", "None", ")", ":", "p", "=", "subprocess", ".", "Popen", "(", "cmd", ",", "shell", "=", "True", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "sub...
run shell command @param cmd: command to execute @param timeout: timeout for command execution @param window: the PySimpleGUI window that the output is going to (needed to do refresh on) @return: (return code from command, command output)
[ "run", "shell", "command" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Script_Launcher_Realtime_Output.py#L29-L45
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWeb/PySimpleGUIWeb.py
font_parse_string
def font_parse_string(font): """ Convert from font string/tyuple into a Qt style sheet string :param font: "Arial 10 Bold" or ('Arial', 10, 'Bold) :return: style string that can be combined with other style strings """ if font is None: return '' if type(font) is str: _font ...
python
def font_parse_string(font): """ Convert from font string/tyuple into a Qt style sheet string :param font: "Arial 10 Bold" or ('Arial', 10, 'Bold) :return: style string that can be combined with other style strings """ if font is None: return '' if type(font) is str: _font ...
[ "def", "font_parse_string", "(", "font", ")", ":", "if", "font", "is", "None", ":", "return", "''", "if", "type", "(", "font", ")", "is", "str", ":", "_font", "=", "font", ".", "split", "(", "' '", ")", "else", ":", "_font", "=", "font", "family", ...
Convert from font string/tyuple into a Qt style sheet string :param font: "Arial 10 Bold" or ('Arial', 10, 'Bold) :return: style string that can be combined with other style strings
[ "Convert", "from", "font", "string", "/", "tyuple", "into", "a", "Qt", "style", "sheet", "string", ":", "param", "font", ":", "Arial", "10", "Bold", "or", "(", "Arial", "10", "Bold", ")", ":", "return", ":", "style", "string", "that", "can", "be", "c...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWeb/PySimpleGUIWeb.py#L3449-L3471
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWeb/PySimpleGUIWeb.py
_ProgressMeter
def _ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None, None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, grab_anywhere=False): ''' Create and show a form on tbe caller's behalf. :param title: :param max_value: :param args: ANY num...
python
def _ProgressMeter(title, max_value, *args, orientation=None, bar_color=(None, None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, grab_anywhere=False): ''' Create and show a form on tbe caller's behalf. :param title: :param max_value: :param args: ANY num...
[ "def", "_ProgressMeter", "(", "title", ",", "max_value", ",", "*", "args", ",", "orientation", "=", "None", ",", "bar_color", "=", "(", "None", ",", "None", ")", ",", "button_color", "=", "None", ",", "size", "=", "DEFAULT_PROGRESS_BAR_SIZE", ",", "border_...
Create and show a form on tbe caller's behalf. :param title: :param max_value: :param args: ANY number of arguments the caller wants to display :param orientation: :param bar_color: :param size: :param Style: :param StyleOffset: :return: ProgressBar object that is in the form
[ "Create", "and", "show", "a", "form", "on", "tbe", "caller", "s", "behalf", ".", ":", "param", "title", ":", ":", "param", "max_value", ":", ":", "param", "args", ":", "ANY", "number", "of", "arguments", "the", "caller", "wants", "to", "display", ":", ...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWeb/PySimpleGUIWeb.py#L5237-L5279
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWeb/PySimpleGUIWeb.py
_ProgressMeterUpdate
def _ProgressMeterUpdate(bar, value, text_elem, *args): ''' Update the progress meter for a form :param form: class ProgressBar :param value: int :return: True if not cancelled, OK....False if Error ''' global _my_windows if bar == None: return False if bar.BarExpired: return False ...
python
def _ProgressMeterUpdate(bar, value, text_elem, *args): ''' Update the progress meter for a form :param form: class ProgressBar :param value: int :return: True if not cancelled, OK....False if Error ''' global _my_windows if bar == None: return False if bar.BarExpired: return False ...
[ "def", "_ProgressMeterUpdate", "(", "bar", ",", "value", ",", "text_elem", ",", "*", "args", ")", ":", "global", "_my_windows", "if", "bar", "==", "None", ":", "return", "False", "if", "bar", ".", "BarExpired", ":", "return", "False", "message", ",", "w"...
Update the progress meter for a form :param form: class ProgressBar :param value: int :return: True if not cancelled, OK....False if Error
[ "Update", "the", "progress", "meter", "for", "a", "form", ":", "param", "form", ":", "class", "ProgressBar", ":", "param", "value", ":", "int", ":", "return", ":", "True", "if", "not", "cancelled", "OK", "....", "False", "if", "Error" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWeb/PySimpleGUIWeb.py#L5283-L5320
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWeb/PySimpleGUIWeb.py
EasyProgressMeter
def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, bar_color=(None, None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None): ''' A ONE-LINE progress meter. Add to your code where ever you need a meter. No need for a second function call...
python
def EasyProgressMeter(title, current_value, max_value, *args, orientation=None, bar_color=(None, None), button_color=None, size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None): ''' A ONE-LINE progress meter. Add to your code where ever you need a meter. No need for a second function call...
[ "def", "EasyProgressMeter", "(", "title", ",", "current_value", ",", "max_value", ",", "*", "args", ",", "orientation", "=", "None", ",", "bar_color", "=", "(", "None", ",", "None", ")", ",", "button_color", "=", "None", ",", "size", "=", "DEFAULT_PROGRESS...
A ONE-LINE progress meter. Add to your code where ever you need a meter. No need for a second function call before your loop. You've got enough code to write! :param title: Title will be shown on the window :param current_value: Current count of your items :param max_value: Max value your count will eve...
[ "A", "ONE", "-", "LINE", "progress", "meter", ".", "Add", "to", "your", "code", "where", "ever", "you", "need", "a", "meter", ".", "No", "need", "for", "a", "second", "function", "call", "before", "your", "loop", ".", "You", "ve", "got", "enough", "c...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWeb/PySimpleGUIWeb.py#L5367-L5432
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWeb/PySimpleGUIWeb.py
PopupNonBlocking
def PopupNonBlocking(*args, button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=True, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=False, keep...
python
def PopupNonBlocking(*args, button_type=POPUP_BUTTONS_OK, button_color=None, background_color=None, text_color=None, auto_close=False, auto_close_duration=None, non_blocking=True, icon=DEFAULT_WINDOW_ICON, line_width=None, font=None, no_titlebar=False, grab_anywhere=False, keep...
[ "def", "PopupNonBlocking", "(", "*", "args", ",", "button_type", "=", "POPUP_BUTTONS_OK", ",", "button_color", "=", "None", ",", "background_color", "=", "None", ",", "text_color", "=", "None", ",", "auto_close", "=", "False", ",", "auto_close_duration", "=", ...
Show Popup box and immediately return (does not block) :param args: :param button_type: :param button_color: :param background_color: :param text_color: :param auto_close: :param auto_close_duration: :param non_blocking: :param icon: :param line_width: :param font: :param...
[ "Show", "Popup", "box", "and", "immediately", "return", "(", "does", "not", "block", ")", ":", "param", "args", ":", ":", "param", "button_type", ":", ":", "param", "button_color", ":", ":", "param", "background_color", ":", ":", "param", "text_color", ":"...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWeb/PySimpleGUIWeb.py#L6286-L6313
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWeb/PySimpleGUIWeb.py
PopupGetFolder
def PopupGetFolder(message, default_path='', no_window=False, size=(None, None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None, None), initial_folder=None): ...
python
def PopupGetFolder(message, default_path='', no_window=False, size=(None, None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None, None), initial_folder=None): ...
[ "def", "PopupGetFolder", "(", "message", ",", "default_path", "=", "''", ",", "no_window", "=", "False", ",", "size", "=", "(", "None", ",", "None", ")", ",", "button_color", "=", "None", ",", "background_color", "=", "None", ",", "text_color", "=", "Non...
Display popup with text entry field and browse button. Browse for folder :param message: :param default_path: :param no_window: :param size: :param button_color: :param background_color: :param text_color: :param icon: :param font: :param no_titlebar: :param grab_anywhere: ...
[ "Display", "popup", "with", "text", "entry", "field", "and", "browse", "button", ".", "Browse", "for", "folder", ":", "param", "message", ":", ":", "param", "default_path", ":", ":", "param", "no_window", ":", ":", "param", "size", ":", ":", "param", "bu...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWeb/PySimpleGUIWeb.py#L6596-L6647
train
PySimpleGUI/PySimpleGUI
PySimpleGUIWeb/PySimpleGUIWeb.py
PopupGetFile
def PopupGetFile(message, default_path='', default_extension='', save_as=False, file_types=(("ALL Files", "*.*"),), no_window=False, size=(None, None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=False...
python
def PopupGetFile(message, default_path='', default_extension='', save_as=False, file_types=(("ALL Files", "*.*"),), no_window=False, size=(None, None), button_color=None, background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False, grab_anywhere=False...
[ "def", "PopupGetFile", "(", "message", ",", "default_path", "=", "''", ",", "default_extension", "=", "''", ",", "save_as", "=", "False", ",", "file_types", "=", "(", "(", "\"ALL Files\"", ",", "\"*.*\"", ")", ",", ")", ",", "no_window", "=", "False", ",...
Display popup with text entry field and browse button. Browse for file :param message: :param default_path: :param default_extension: :param save_as: :param file_types: :param no_window: :param size: :param button_color: :param background_color: :param text_color: :param icon...
[ "Display", "popup", "with", "text", "entry", "field", "and", "browse", "button", ".", "Browse", "for", "file", ":", "param", "message", ":", ":", "param", "default_path", ":", ":", "param", "default_extension", ":", ":", "param", "save_as", ":", ":", "para...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/PySimpleGUIWeb/PySimpleGUIWeb.py#L6652-L6714
train
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Table_Simulation.py
TableSimulation
def TableSimulation(): """ Display data in a table format """ sg.SetOptions(element_padding=(0,0)) menu_def = [['File', ['Open', 'Save', 'Exit']], ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], ['Help', 'About...'],] columm_layout = [[]] MAX_ROWS = 2...
python
def TableSimulation(): """ Display data in a table format """ sg.SetOptions(element_padding=(0,0)) menu_def = [['File', ['Open', 'Save', 'Exit']], ['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],], ['Help', 'About...'],] columm_layout = [[]] MAX_ROWS = 2...
[ "def", "TableSimulation", "(", ")", ":", "sg", ".", "SetOptions", "(", "element_padding", "=", "(", "0", ",", "0", ")", ")", "menu_def", "=", "[", "[", "'File'", ",", "[", "'Open'", ",", "'Save'", ",", "'Exit'", "]", "]", ",", "[", "'Edit'", ",", ...
Display data in a table format
[ "Display", "data", "in", "a", "table", "format" ]
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Table_Simulation.py#L10-L78
train
PySimpleGUI/PySimpleGUI
HowDoI/PySimpleGUI-HowDoI.py
HowDoI
def HowDoI(): ''' Make and show a window (PySimpleGUI form) that takes user input and sends to the HowDoI web oracle Excellent example of 2 GUI concepts 1. Output Element that will show text in a scrolled window 2. Non-Window-Closing Buttons - These buttons will cause the form to return with...
python
def HowDoI(): ''' Make and show a window (PySimpleGUI form) that takes user input and sends to the HowDoI web oracle Excellent example of 2 GUI concepts 1. Output Element that will show text in a scrolled window 2. Non-Window-Closing Buttons - These buttons will cause the form to return with...
[ "def", "HowDoI", "(", ")", ":", "# ------- Make a new Window ------- #", "sg", ".", "ChangeLookAndFeel", "(", "'GreenTan'", ")", "# give our form a spiffy set of colors", "layout", "=", "[", "[", "sg", ".", "Text", "(", "'Ask and your answer will appear here....'", ",",...
Make and show a window (PySimpleGUI form) that takes user input and sends to the HowDoI web oracle Excellent example of 2 GUI concepts 1. Output Element that will show text in a scrolled window 2. Non-Window-Closing Buttons - These buttons will cause the form to return with the form's values, but do...
[ "Make", "and", "show", "a", "window", "(", "PySimpleGUI", "form", ")", "that", "takes", "user", "input", "and", "sends", "to", "the", "HowDoI", "web", "oracle", "Excellent", "example", "of", "2", "GUI", "concepts", "1", ".", "Output", "Element", "that", ...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/HowDoI/PySimpleGUI-HowDoI.py#L16-L69
train
PySimpleGUI/PySimpleGUI
HowDoI/PySimpleGUI-HowDoI.py
QueryHowDoI
def QueryHowDoI(Query, num_answers, full_text): ''' Kicks off a subprocess to send the 'Query' to HowDoI Prints the result, which in this program will route to a gooeyGUI window :param Query: text english question to ask the HowDoI web engine :return: nothing ''' howdoi_command = HOW_DO_I_CO...
python
def QueryHowDoI(Query, num_answers, full_text): ''' Kicks off a subprocess to send the 'Query' to HowDoI Prints the result, which in this program will route to a gooeyGUI window :param Query: text english question to ask the HowDoI web engine :return: nothing ''' howdoi_command = HOW_DO_I_CO...
[ "def", "QueryHowDoI", "(", "Query", ",", "num_answers", ",", "full_text", ")", ":", "howdoi_command", "=", "HOW_DO_I_COMMAND", "full_text_option", "=", "' -a'", "if", "full_text", "else", "''", "t", "=", "subprocess", ".", "Popen", "(", "howdoi_command", "+", ...
Kicks off a subprocess to send the 'Query' to HowDoI Prints the result, which in this program will route to a gooeyGUI window :param Query: text english question to ask the HowDoI web engine :return: nothing
[ "Kicks", "off", "a", "subprocess", "to", "send", "the", "Query", "to", "HowDoI", "Prints", "the", "result", "which", "in", "this", "program", "will", "route", "to", "a", "gooeyGUI", "window", ":", "param", "Query", ":", "text", "english", "question", "to",...
08184197f5bd4580ab5e5aca28bdda30f87b86fc
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/HowDoI/PySimpleGUI-HowDoI.py#L72-L86
train
tensorflow/hub
tensorflow_hub/module_spec.py
ModuleSpec.export
def export(self, path, _sentinel=None, # pylint: disable=invalid-name checkpoint_path=None, name_transform_fn=None): """Exports a ModuleSpec with weights taken from a checkpoint. This is an helper to export modules directly from a ModuleSpec without having to create a session and set the vari...
python
def export(self, path, _sentinel=None, # pylint: disable=invalid-name checkpoint_path=None, name_transform_fn=None): """Exports a ModuleSpec with weights taken from a checkpoint. This is an helper to export modules directly from a ModuleSpec without having to create a session and set the vari...
[ "def", "export", "(", "self", ",", "path", ",", "_sentinel", "=", "None", ",", "# pylint: disable=invalid-name", "checkpoint_path", "=", "None", ",", "name_transform_fn", "=", "None", ")", ":", "from", "tensorflow_hub", ".", "module", "import", "export_module_spec...
Exports a ModuleSpec with weights taken from a checkpoint. This is an helper to export modules directly from a ModuleSpec without having to create a session and set the variables to the intended values. Example usage: ```python spec = hub.create_module_spec(module_fn) spec.export("/path/t...
[ "Exports", "a", "ModuleSpec", "with", "weights", "taken", "from", "a", "checkpoint", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/module_spec.py#L41-L77
train
tensorflow/hub
tensorflow_hub/module_spec.py
ModuleSpec.get_attached_message
def get_attached_message(self, key, message_type, tags=None, required=False): """Returns the message attached to the module under the given key, or None. Module publishers can attach protocol messages to modules at creation time to provide module consumers with additional information, e.g., on module u...
python
def get_attached_message(self, key, message_type, tags=None, required=False): """Returns the message attached to the module under the given key, or None. Module publishers can attach protocol messages to modules at creation time to provide module consumers with additional information, e.g., on module u...
[ "def", "get_attached_message", "(", "self", ",", "key", ",", "message_type", ",", "tags", "=", "None", ",", "required", "=", "False", ")", ":", "attached_bytes", "=", "self", ".", "_get_attached_bytes", "(", "key", ",", "tags", ")", "if", "attached_bytes", ...
Returns the message attached to the module under the given key, or None. Module publishers can attach protocol messages to modules at creation time to provide module consumers with additional information, e.g., on module usage or provenance (see see hub.attach_message()). A typical use would be to stor...
[ "Returns", "the", "message", "attached", "to", "the", "module", "under", "the", "given", "key", "or", "None", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/module_spec.py#L129-L169
train
tensorflow/hub
examples/image_retraining/retrain.py
create_image_lists
def create_image_lists(image_dir, testing_percentage, validation_percentage): """Builds a list of training images from the file system. Analyzes the sub folders in the image directory, splits them into stable training, testing, and validation sets, and returns a data structure describing the lists of images fo...
python
def create_image_lists(image_dir, testing_percentage, validation_percentage): """Builds a list of training images from the file system. Analyzes the sub folders in the image directory, splits them into stable training, testing, and validation sets, and returns a data structure describing the lists of images fo...
[ "def", "create_image_lists", "(", "image_dir", ",", "testing_percentage", ",", "validation_percentage", ")", ":", "if", "not", "tf", ".", "gfile", ".", "Exists", "(", "image_dir", ")", ":", "tf", ".", "logging", ".", "error", "(", "\"Image directory '\"", "+",...
Builds a list of training images from the file system. Analyzes the sub folders in the image directory, splits them into stable training, testing, and validation sets, and returns a data structure describing the lists of images for each label and their paths. Args: image_dir: String path to a folder conta...
[ "Builds", "a", "list", "of", "training", "images", "from", "the", "file", "system", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L147-L234
train
tensorflow/hub
examples/image_retraining/retrain.py
get_image_path
def get_image_path(image_lists, label_name, index, image_dir, category): """Returns a path to an image for a label at the given index. Args: image_lists: OrderedDict of training images for each label. label_name: Label string we want to get an image for. index: Int offset of the image we want. This wil...
python
def get_image_path(image_lists, label_name, index, image_dir, category): """Returns a path to an image for a label at the given index. Args: image_lists: OrderedDict of training images for each label. label_name: Label string we want to get an image for. index: Int offset of the image we want. This wil...
[ "def", "get_image_path", "(", "image_lists", ",", "label_name", ",", "index", ",", "image_dir", ",", "category", ")", ":", "if", "label_name", "not", "in", "image_lists", ":", "tf", ".", "logging", ".", "fatal", "(", "'Label does not exist %s.'", ",", "label_n...
Returns a path to an image for a label at the given index. Args: image_lists: OrderedDict of training images for each label. label_name: Label string we want to get an image for. index: Int offset of the image we want. This will be moduloed by the available number of images for the label, so it can b...
[ "Returns", "a", "path", "to", "an", "image", "for", "a", "label", "at", "the", "given", "index", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L237-L267
train
tensorflow/hub
examples/image_retraining/retrain.py
get_bottleneck_path
def get_bottleneck_path(image_lists, label_name, index, bottleneck_dir, category, module_name): """Returns a path to a bottleneck file for a label at the given index. Args: image_lists: OrderedDict of training images for each label. label_name: Label string we want to get an image f...
python
def get_bottleneck_path(image_lists, label_name, index, bottleneck_dir, category, module_name): """Returns a path to a bottleneck file for a label at the given index. Args: image_lists: OrderedDict of training images for each label. label_name: Label string we want to get an image f...
[ "def", "get_bottleneck_path", "(", "image_lists", ",", "label_name", ",", "index", ",", "bottleneck_dir", ",", "category", ",", "module_name", ")", ":", "module_name", "=", "(", "module_name", ".", "replace", "(", "'://'", ",", "'~'", ")", "# URL scheme.", "."...
Returns a path to a bottleneck file for a label at the given index. Args: image_lists: OrderedDict of training images for each label. label_name: Label string we want to get an image for. index: Integer offset of the image we want. This will be moduloed by the available number of images for the label...
[ "Returns", "a", "path", "to", "a", "bottleneck", "file", "for", "a", "label", "at", "the", "given", "index", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L270-L291
train
tensorflow/hub
examples/image_retraining/retrain.py
create_module_graph
def create_module_graph(module_spec): """Creates a graph and loads Hub Module into it. Args: module_spec: the hub.ModuleSpec for the image module being used. Returns: graph: the tf.Graph that was created. bottleneck_tensor: the bottleneck values output by the module. resized_input_tensor: the in...
python
def create_module_graph(module_spec): """Creates a graph and loads Hub Module into it. Args: module_spec: the hub.ModuleSpec for the image module being used. Returns: graph: the tf.Graph that was created. bottleneck_tensor: the bottleneck values output by the module. resized_input_tensor: the in...
[ "def", "create_module_graph", "(", "module_spec", ")", ":", "height", ",", "width", "=", "hub", ".", "get_expected_image_size", "(", "module_spec", ")", "with", "tf", ".", "Graph", "(", ")", ".", "as_default", "(", ")", "as", "graph", ":", "resized_input_ten...
Creates a graph and loads Hub Module into it. Args: module_spec: the hub.ModuleSpec for the image module being used. Returns: graph: the tf.Graph that was created. bottleneck_tensor: the bottleneck values output by the module. resized_input_tensor: the input images, resized as expected by the modu...
[ "Creates", "a", "graph", "and", "loads", "Hub", "Module", "into", "it", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L294-L314
train
tensorflow/hub
examples/image_retraining/retrain.py
run_bottleneck_on_image
def run_bottleneck_on_image(sess, image_data, image_data_tensor, decoded_image_tensor, resized_input_tensor, bottleneck_tensor): """Runs inference on an image to extract the 'bottleneck' summary layer. Args: sess: Current active TensorFlow Session. im...
python
def run_bottleneck_on_image(sess, image_data, image_data_tensor, decoded_image_tensor, resized_input_tensor, bottleneck_tensor): """Runs inference on an image to extract the 'bottleneck' summary layer. Args: sess: Current active TensorFlow Session. im...
[ "def", "run_bottleneck_on_image", "(", "sess", ",", "image_data", ",", "image_data_tensor", ",", "decoded_image_tensor", ",", "resized_input_tensor", ",", "bottleneck_tensor", ")", ":", "# First decode the JPEG image, resize it, and rescale the pixel values.", "resized_input_values...
Runs inference on an image to extract the 'bottleneck' summary layer. Args: sess: Current active TensorFlow Session. image_data: String of raw JPEG data. image_data_tensor: Input data layer in the graph. decoded_image_tensor: Output of initial image resizing and preprocessing. resized_input_tenso...
[ "Runs", "inference", "on", "an", "image", "to", "extract", "the", "bottleneck", "summary", "layer", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L317-L340
train
tensorflow/hub
examples/image_retraining/retrain.py
create_bottleneck_file
def create_bottleneck_file(bottleneck_path, image_lists, label_name, index, image_dir, category, sess, jpeg_data_tensor, decoded_image_tensor, resized_input_tensor, bottleneck_tensor): """Create a single bottleneck file.""" tf.logging....
python
def create_bottleneck_file(bottleneck_path, image_lists, label_name, index, image_dir, category, sess, jpeg_data_tensor, decoded_image_tensor, resized_input_tensor, bottleneck_tensor): """Create a single bottleneck file.""" tf.logging....
[ "def", "create_bottleneck_file", "(", "bottleneck_path", ",", "image_lists", ",", "label_name", ",", "index", ",", "image_dir", ",", "category", ",", "sess", ",", "jpeg_data_tensor", ",", "decoded_image_tensor", ",", "resized_input_tensor", ",", "bottleneck_tensor", "...
Create a single bottleneck file.
[ "Create", "a", "single", "bottleneck", "file", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L353-L373
train
tensorflow/hub
examples/image_retraining/retrain.py
get_or_create_bottleneck
def get_or_create_bottleneck(sess, image_lists, label_name, index, image_dir, category, bottleneck_dir, jpeg_data_tensor, decoded_image_tensor, resized_input_tensor, bottleneck_tensor, module_name): """Retrieves or calculates bottl...
python
def get_or_create_bottleneck(sess, image_lists, label_name, index, image_dir, category, bottleneck_dir, jpeg_data_tensor, decoded_image_tensor, resized_input_tensor, bottleneck_tensor, module_name): """Retrieves or calculates bottl...
[ "def", "get_or_create_bottleneck", "(", "sess", ",", "image_lists", ",", "label_name", ",", "index", ",", "image_dir", ",", "category", ",", "bottleneck_dir", ",", "jpeg_data_tensor", ",", "decoded_image_tensor", ",", "resized_input_tensor", ",", "bottleneck_tensor", ...
Retrieves or calculates bottleneck values for an image. If a cached version of the bottleneck data exists on-disk, return that, otherwise calculate the data and save it to disk for future use. Args: sess: The current active TensorFlow Session. image_lists: OrderedDict of training images for each label. ...
[ "Retrieves", "or", "calculates", "bottleneck", "values", "for", "an", "image", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L376-L434
train
tensorflow/hub
examples/image_retraining/retrain.py
cache_bottlenecks
def cache_bottlenecks(sess, image_lists, image_dir, bottleneck_dir, jpeg_data_tensor, decoded_image_tensor, resized_input_tensor, bottleneck_tensor, module_name): """Ensures all the training, testing, and validation bottlenecks are cached. Because we're likely to read th...
python
def cache_bottlenecks(sess, image_lists, image_dir, bottleneck_dir, jpeg_data_tensor, decoded_image_tensor, resized_input_tensor, bottleneck_tensor, module_name): """Ensures all the training, testing, and validation bottlenecks are cached. Because we're likely to read th...
[ "def", "cache_bottlenecks", "(", "sess", ",", "image_lists", ",", "image_dir", ",", "bottleneck_dir", ",", "jpeg_data_tensor", ",", "decoded_image_tensor", ",", "resized_input_tensor", ",", "bottleneck_tensor", ",", "module_name", ")", ":", "how_many_bottlenecks", "=", ...
Ensures all the training, testing, and validation bottlenecks are cached. Because we're likely to read the same image multiple times (if there are no distortions applied during training) it can speed things up a lot if we calculate the bottleneck layer values once for each image during preprocessing, and then ...
[ "Ensures", "all", "the", "training", "testing", "and", "validation", "bottlenecks", "are", "cached", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L437-L478
train
tensorflow/hub
examples/image_retraining/retrain.py
get_random_cached_bottlenecks
def get_random_cached_bottlenecks(sess, image_lists, how_many, category, bottleneck_dir, image_dir, jpeg_data_tensor, decoded_image_tensor, resized_input_tensor, bottleneck_tensor, module_name): """Retrieves bottlene...
python
def get_random_cached_bottlenecks(sess, image_lists, how_many, category, bottleneck_dir, image_dir, jpeg_data_tensor, decoded_image_tensor, resized_input_tensor, bottleneck_tensor, module_name): """Retrieves bottlene...
[ "def", "get_random_cached_bottlenecks", "(", "sess", ",", "image_lists", ",", "how_many", ",", "category", ",", "bottleneck_dir", ",", "image_dir", ",", "jpeg_data_tensor", ",", "decoded_image_tensor", ",", "resized_input_tensor", ",", "bottleneck_tensor", ",", "module_...
Retrieves bottleneck values for cached images. If no distortions are being applied, this function can retrieve the cached bottleneck values directly from disk for images. It picks a random set of images from the specified category. Args: sess: Current TensorFlow Session. image_lists: OrderedDict of tr...
[ "Retrieves", "bottleneck", "values", "for", "cached", "images", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L481-L544
train
tensorflow/hub
examples/image_retraining/retrain.py
get_random_distorted_bottlenecks
def get_random_distorted_bottlenecks( sess, image_lists, how_many, category, image_dir, input_jpeg_tensor, distorted_image, resized_input_tensor, bottleneck_tensor): """Retrieves bottleneck values for training images, after distortions. If we're training with distortions like crops, scales, or flips, we ha...
python
def get_random_distorted_bottlenecks( sess, image_lists, how_many, category, image_dir, input_jpeg_tensor, distorted_image, resized_input_tensor, bottleneck_tensor): """Retrieves bottleneck values for training images, after distortions. If we're training with distortions like crops, scales, or flips, we ha...
[ "def", "get_random_distorted_bottlenecks", "(", "sess", ",", "image_lists", ",", "how_many", ",", "category", ",", "image_dir", ",", "input_jpeg_tensor", ",", "distorted_image", ",", "resized_input_tensor", ",", "bottleneck_tensor", ")", ":", "class_count", "=", "len"...
Retrieves bottleneck values for training images, after distortions. If we're training with distortions like crops, scales, or flips, we have to recalculate the full model for every image, and so we can't use cached bottleneck values. Instead we find random images for the requested category, run them through th...
[ "Retrieves", "bottleneck", "values", "for", "training", "images", "after", "distortions", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L547-L596
train
tensorflow/hub
examples/image_retraining/retrain.py
add_input_distortions
def add_input_distortions(flip_left_right, random_crop, random_scale, random_brightness, module_spec): """Creates the operations to apply the specified distortions. During training it can help to improve the results if we run the images through simple distortions like crops, scales, and...
python
def add_input_distortions(flip_left_right, random_crop, random_scale, random_brightness, module_spec): """Creates the operations to apply the specified distortions. During training it can help to improve the results if we run the images through simple distortions like crops, scales, and...
[ "def", "add_input_distortions", "(", "flip_left_right", ",", "random_crop", ",", "random_scale", ",", "random_brightness", ",", "module_spec", ")", ":", "input_height", ",", "input_width", "=", "hub", ".", "get_expected_image_size", "(", "module_spec", ")", "input_dep...
Creates the operations to apply the specified distortions. During training it can help to improve the results if we run the images through simple distortions like crops, scales, and flips. These reflect the kind of variations we expect in the real world, and so can help train the model to cope with natural dat...
[ "Creates", "the", "operations", "to", "apply", "the", "specified", "distortions", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L617-L706
train
tensorflow/hub
examples/image_retraining/retrain.py
variable_summaries
def variable_summaries(var): """Attach a lot of summaries to a Tensor (for TensorBoard visualization).""" with tf.name_scope('summaries'): mean = tf.reduce_mean(var) tf.summary.scalar('mean', mean) with tf.name_scope('stddev'): stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean))) tf.summary...
python
def variable_summaries(var): """Attach a lot of summaries to a Tensor (for TensorBoard visualization).""" with tf.name_scope('summaries'): mean = tf.reduce_mean(var) tf.summary.scalar('mean', mean) with tf.name_scope('stddev'): stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean))) tf.summary...
[ "def", "variable_summaries", "(", "var", ")", ":", "with", "tf", ".", "name_scope", "(", "'summaries'", ")", ":", "mean", "=", "tf", ".", "reduce_mean", "(", "var", ")", "tf", ".", "summary", ".", "scalar", "(", "'mean'", ",", "mean", ")", "with", "t...
Attach a lot of summaries to a Tensor (for TensorBoard visualization).
[ "Attach", "a", "lot", "of", "summaries", "to", "a", "Tensor", "(", "for", "TensorBoard", "visualization", ")", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L709-L719
train
tensorflow/hub
examples/image_retraining/retrain.py
add_final_retrain_ops
def add_final_retrain_ops(class_count, final_tensor_name, bottleneck_tensor, quantize_layer, is_training): """Adds a new softmax and fully-connected layer for training and eval. We need to retrain the top layer to identify our new classes, so this function adds the right operations to t...
python
def add_final_retrain_ops(class_count, final_tensor_name, bottleneck_tensor, quantize_layer, is_training): """Adds a new softmax and fully-connected layer for training and eval. We need to retrain the top layer to identify our new classes, so this function adds the right operations to t...
[ "def", "add_final_retrain_ops", "(", "class_count", ",", "final_tensor_name", ",", "bottleneck_tensor", ",", "quantize_layer", ",", "is_training", ")", ":", "batch_size", ",", "bottleneck_tensor_size", "=", "bottleneck_tensor", ".", "get_shape", "(", ")", ".", "as_lis...
Adds a new softmax and fully-connected layer for training and eval. We need to retrain the top layer to identify our new classes, so this function adds the right operations to the graph, along with some variables to hold the weights, and then sets up all the gradients for the backward pass. The set up for the...
[ "Adds", "a", "new", "softmax", "and", "fully", "-", "connected", "layer", "for", "training", "and", "eval", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L722-L804
train
tensorflow/hub
examples/image_retraining/retrain.py
add_evaluation_step
def add_evaluation_step(result_tensor, ground_truth_tensor): """Inserts the operations we need to evaluate the accuracy of our results. Args: result_tensor: The new final node that produces results. ground_truth_tensor: The node we feed ground truth data into. Returns: Tuple of (evaluation step,...
python
def add_evaluation_step(result_tensor, ground_truth_tensor): """Inserts the operations we need to evaluate the accuracy of our results. Args: result_tensor: The new final node that produces results. ground_truth_tensor: The node we feed ground truth data into. Returns: Tuple of (evaluation step,...
[ "def", "add_evaluation_step", "(", "result_tensor", ",", "ground_truth_tensor", ")", ":", "with", "tf", ".", "name_scope", "(", "'accuracy'", ")", ":", "with", "tf", ".", "name_scope", "(", "'correct_prediction'", ")", ":", "prediction", "=", "tf", ".", "argma...
Inserts the operations we need to evaluate the accuracy of our results. Args: result_tensor: The new final node that produces results. ground_truth_tensor: The node we feed ground truth data into. Returns: Tuple of (evaluation step, prediction).
[ "Inserts", "the", "operations", "we", "need", "to", "evaluate", "the", "accuracy", "of", "our", "results", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L807-L825
train
tensorflow/hub
examples/image_retraining/retrain.py
run_final_eval
def run_final_eval(train_session, module_spec, class_count, image_lists, jpeg_data_tensor, decoded_image_tensor, resized_image_tensor, bottleneck_tensor): """Runs a final evaluation on an eval graph using the test data set. Args: train_session: Session for the train graph ...
python
def run_final_eval(train_session, module_spec, class_count, image_lists, jpeg_data_tensor, decoded_image_tensor, resized_image_tensor, bottleneck_tensor): """Runs a final evaluation on an eval graph using the test data set. Args: train_session: Session for the train graph ...
[ "def", "run_final_eval", "(", "train_session", ",", "module_spec", ",", "class_count", ",", "image_lists", ",", "jpeg_data_tensor", ",", "decoded_image_tensor", ",", "resized_image_tensor", ",", "bottleneck_tensor", ")", ":", "test_bottlenecks", ",", "test_ground_truth", ...
Runs a final evaluation on an eval graph using the test data set. Args: train_session: Session for the train graph with the tensors below. module_spec: The hub.ModuleSpec for the image module being used. class_count: Number of classes image_lists: OrderedDict of training images for each label. jp...
[ "Runs", "a", "final", "evaluation", "on", "an", "eval", "graph", "using", "the", "test", "data", "set", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L828-L867
train
tensorflow/hub
examples/image_retraining/retrain.py
build_eval_session
def build_eval_session(module_spec, class_count): """Builds an restored eval session without train operations for exporting. Args: module_spec: The hub.ModuleSpec for the image module being used. class_count: Number of classes Returns: Eval session containing the restored eval graph. The bottlen...
python
def build_eval_session(module_spec, class_count): """Builds an restored eval session without train operations for exporting. Args: module_spec: The hub.ModuleSpec for the image module being used. class_count: Number of classes Returns: Eval session containing the restored eval graph. The bottlen...
[ "def", "build_eval_session", "(", "module_spec", ",", "class_count", ")", ":", "# If quantized, we need to create the correct eval graph for exporting.", "eval_graph", ",", "bottleneck_tensor", ",", "resized_input_tensor", ",", "wants_quantization", "=", "(", "create_module_graph...
Builds an restored eval session without train operations for exporting. Args: module_spec: The hub.ModuleSpec for the image module being used. class_count: Number of classes Returns: Eval session containing the restored eval graph. The bottleneck input, ground truth, eval step, and prediction tens...
[ "Builds", "an", "restored", "eval", "session", "without", "train", "operations", "for", "exporting", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L870-L901
train
tensorflow/hub
examples/image_retraining/retrain.py
save_graph_to_file
def save_graph_to_file(graph_file_name, module_spec, class_count): """Saves an graph to file, creating a valid quantized one if necessary.""" sess, _, _, _, _, _ = build_eval_session(module_spec, class_count) graph = sess.graph output_graph_def = tf.graph_util.convert_variables_to_constants( sess, graph....
python
def save_graph_to_file(graph_file_name, module_spec, class_count): """Saves an graph to file, creating a valid quantized one if necessary.""" sess, _, _, _, _, _ = build_eval_session(module_spec, class_count) graph = sess.graph output_graph_def = tf.graph_util.convert_variables_to_constants( sess, graph....
[ "def", "save_graph_to_file", "(", "graph_file_name", ",", "module_spec", ",", "class_count", ")", ":", "sess", ",", "_", ",", "_", ",", "_", ",", "_", ",", "_", "=", "build_eval_session", "(", "module_spec", ",", "class_count", ")", "graph", "=", "sess", ...
Saves an graph to file, creating a valid quantized one if necessary.
[ "Saves", "an", "graph", "to", "file", "creating", "a", "valid", "quantized", "one", "if", "necessary", "." ]
09f45963f6787322967b6fec61459f3ac56fbb27
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/examples/image_retraining/retrain.py#L904-L913
train