本文整理汇总了Python中HTML.HTML.img方法的典型用法代码示例。如果您正苦于以下问题:Python HTML.img方法的具体用法?Python HTML.img怎么用?Python HTML.img使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML.HTML
的用法示例。
在下文中一共展示了HTML.img方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: outputHtmlUserlist
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import img [as 别名]
def outputHtmlUserlist(fname, db, keys):
h = HTML()
head = h.head("")
with h.body(""):
with h.table(border='1', newlines=True):
with h.colgroup:
h.col(span="1", style="width: 64px;")
h.col(span="1", style="width: 130px;")
h.col(span="1", style="width: 250px;")
h.col(span="1", style="width: 250px;")
with h.tr:
h.th("avatar")
h.th("username")
h.th("fullname")
h.th("location")
for u in keys:
with h.tr:
with h.td():
h.img('',src=escape(db.usernames[u].avatar), width="64", height="64")
h.td(u)
h.td(escape(db.usernames[u].fullname))
h.td(escape(db.usernames[u].location))
open(fname, "w").write(str(h))
示例2: __init__
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import img [as 别名]
#.........这里部分代码省略.........
# --- Convert newlines
if newlines:
res = str.replace(res, '\n', '<br>')
# --- Return
return res
# ----------------------------------------------------------------------
def truncate(self, s, limit=100, suffix='...'):
'''
Smart truncate
Inputs:
M (tuple) The text in many languages
Output:
The text in the current language
'''
if len(s) <= limit:
return s
else:
return ' '.join(s[:limit+1].split(' ')[0:-1]) + suffix
# ----------------------------------------------------------------------
def redirect(self, location):
'''
Redirection (javascript based)
Inputs:
location (str) The new spot location
Output
None
'''
self.html.javascript('document.location.href="{0}"'.format(location))
# ----------------------------------------------------------------------
def language_chooser(self):
'''
Language chooser
Inputs:
-
Output
None
'''
# --- Store reference
ref = self.html.ref
# Language container
self.html.div(0, id='language')
if self.session.language != 'en':
self.html.a(0, "?spot={0}&lang=en".format(self.settings.get('spot')))
self.html.img(0, 'Core/Style/Icons/Flags/English.png')
if self.session.language != 'fr':
self.html.a(0, "?spot={0}&lang=fr".format(self.settings.get('spot')))
self.html.img(0, 'Core/Style/Icons/Flags/French.png')
# --- Restore reference
self.html.ref = ref
# ----------------------------------------------------------------------
def main_menu(self, mid):
'''
Append the main menu.
Inputs:
None
Output:
None
'''
# Logo
self.html.a(mid, '?spot=home')
self.html.img(0, 'Core/Style/Logo.svg', id='logo')
# Language chooser
self.html.ref = mid
self.language_chooser()
self.html.a(0, '?spot=connection', id='disconnection')
# Menu containers
self.html.div(mid, id='menu')
self.html.a(0, '?spot=settings', id="menu_Param", cls='menu_item')
self.html.text(0, ("General settings", "Paramètres généraux"))
self.html.a(-1, '?spot=users', id='menu_Users', cls='menu_item')
self.html.text(0, ("Manage users", "Gestion des utilisateurs"))
self.html.a(-1, '?spot=locations', id='menu_Locations', cls='menu_item')
self.html.text(0, ("Storage locations", "Espaces de stockage"))
示例3: __init__
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import img [as 别名]
#.........这里部分代码省略.........
def redirect(self, location):
"""
Redirection (javascript based)
Inputs:
location (str) The new spot location
Output
None
"""
self.html.javascript('document.location.href="{0}"'.format(location))
# ----------------------------------------------------------------------
def language_chooser(self):
"""
Language chooser
Inputs:
-
Output
None
"""
# --- Store reference
ref = self.html.ref
# Language container
self.html.div(0, id="language")
if self.session.language != "en":
self.html.a(0, "?spot={0}&lang=en".format(self.settings.get("spot")))
self.html.img(0, "Core/Style/Icons/Flags/English.png")
if self.session.language != "fr":
self.html.a(0, "?spot={0}&lang=fr".format(self.settings.get("spot")))
self.html.img(0, "Core/Style/Icons/Flags/French.png")
# --- Restore reference
self.html.ref = ref
# ----------------------------------------------------------------------
def navbar(self, tree, main, last, page=()):
"""
Append a navigation bar.
Inputs:
- parent (int) The identifier of the most remote element
Output:
None
"""
# Append style and javascript to the head
self.html.style("navbar")
self.html.jsfile("Core/JS/navbar.js")
# Main contener
self.html.div(main, id="navbar")
# Get parent list
P = int(last)
Plist = []
while True:
Plist.extend([P])