当前位置: 首页>>代码示例>>Python>>正文


Python WConio.puttext方法代码示例

本文整理汇总了Python中WConio.puttext方法的典型用法代码示例。如果您正苦于以下问题:Python WConio.puttext方法的具体用法?Python WConio.puttext怎么用?Python WConio.puttext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WConio的用法示例。


在下文中一共展示了WConio.puttext方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: draw_terminal

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import puttext [as 别名]
def draw_terminal():
    y = Terminal.top
    W.puttext(Terminal.left, y, Terminal.left + Terminal.width -1, y + Terminal.height -1, Terminal.clear_buffer)

    for line in Terminal.buffer[Terminal.scroll_offset:Terminal.scroll_offset+Terminal.height]:
        W.puttext(Terminal.left, y, min(Terminal.width, Terminal.left + line.width - 1), y, line.buf)
        y += 1
开发者ID:jtruscott,项目名称:ld21,代码行数:9,代码来源:terminal.py

示例2: draw_buffer

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import puttext [as 别名]
def draw_buffer(buf, x, y):
    if buf.dirty:
        #generate a wconio buffer
        buf._text = render_buffer(buf)
        buf.dirty = False
    
    W.puttext(x, y,
            x + buf.width-1,
            y + buf.height-1,
            buf._text
    )
开发者ID:jtruscott,项目名称:pyweek13,代码行数:13,代码来源:term_win.py

示例3: draw_condition_bar

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import puttext [as 别名]
def draw_condition_bar(base):
    x, y = base.x + len(base.text), base.y
    hp, max_hp = game.player.hp, game.player.max_hp
    buf = []
    for i in range(1, max_hp + 1):
        if hp >= i:
            color = draw.color_char(W.GREEN)
        else:
            color = draw.color_char(W.RED)
        buf.extend([C.Characters.half_box, color])

    buf = "".join(buf)
    W.puttext(x, y, x + max_hp - 1, y, buf)
开发者ID:non,项目名称:ld21,代码行数:15,代码来源:hud.py

示例4: draw_box

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import puttext [as 别名]
def draw_box(left=None, top=None, width=None, height=None,  box=None, **kwargs):
    if width is None and box:
        #box is a Box namedtuple
        width = box.width
        height = box.height
    if left is None and box:
        #and can also have positioning
        left = box.left
        top = box.top

    if box is None and width:
        #or you can just give w/h and let it make you one
        box = create_box(width, height, left=left, top=top, **kwargs)
    
    W.puttext(left, top, left+width-1, top+height-1, box.buf)
    return box
开发者ID:jtruscott,项目名称:ld21,代码行数:18,代码来源:draw.py

示例5: show_confirmation

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import puttext [as 别名]
def show_confirmation(line1=' ', line2=' '):
    line1 = terminal.Line.parse(line1)[0]
    line2 = terminal.Line.parse(line2)[0]
    width = max(14, max(line1.width, line2.width) + 2)
    height = 8
    left = (C.width - width) / 2
    top = (C.height - height) / 2
    previous_buf = W.gettext(left, top, left + width, top + height)
    btn_width = 7
    btn_height = 4
    btn_offset = 3
    try:
        container = draw.draw_box(left, top, width, height,
                                    border_color=W.LIGHTBLUE, border_background_color = W.BLUE)
        W.puttext(left+1, top + 1, left + line1.width, top + 1, line1.buf)
        W.puttext(left+1, top + 2, left + line2.width, top + 2, line2.buf)

        yes_button = draw.draw_box(left + btn_offset, top + height - btn_height, btn_width, btn_height,
                                    border_color=W.LIGHTBLUE, border_background_color = W.BLUE,
                                    corners = {'bl': 'teeup', 'br': 'teeup'})

        no_button = draw.draw_box(left + width - btn_offset - btn_width, top + height - btn_height, btn_width, btn_height,
                                    border_color=W.LIGHTBLUE, border_background_color = W.BLUE,
                                    corners = {'bl': 'teeup', 'br': 'teeup'})

        yes_text = draw.Text(W.DARKGREY, 1, 1, "YES".center(btn_width -2 ))
        no_text = draw.Text(W.WHITE, 1, 1, "NO".center(btn_width -2 ))
        yes_button.text.append(yes_text)
        no_button.text.append(no_text)
        selected_button = no_button

        while True:
            if selected_button == yes_button:
                yes_text.color = W.WHITE
                no_text.color = W.DARKGREY
            else:
                no_text.color = W.WHITE
                yes_text.color = W.DARKGREY
            draw.draw_box_text(yes_button)
            draw.draw_box_text(no_button)
            (chn, chs) = W.getch()
            #figure out if we're done
            if chs == '\r':
                #enter, exit
                break
            if chs == 'y':
                selected_button = yes_button
                break

            if chs == 'n':
                selected_button = no_button
                break

            if chn == 0 or chn == 224:
                #special keys come in two parts
                (chn2, _) = W.getch()
                if chn2 in W.__keydict:
                    name = W.__keydict[chn2]
                    if 'left' in name or 'right' in name:
                        selected_button = (selected_button == yes_button and no_button or yes_button)

        return (selected_button == yes_button and True or False)

    finally:
        #Restore what we scribbled on
        W.puttext(left, top, left + width, top + height, previous_buf)
开发者ID:jtruscott,项目名称:ld21,代码行数:68,代码来源:gameprompt.py

示例6: draw_scrollbar

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import puttext [as 别名]
def draw_scrollbar():
    buf = ''.join(['%s%s' % (a,b) for a,b in Scrollbar.arr])
    W.puttext(Scrollbar.left, Scrollbar.top, Scrollbar.left, Scrollbar.top + Terminal.height - 1, buf)
开发者ID:jtruscott,项目名称:ld21,代码行数:5,代码来源:terminal.py

示例7: close

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import puttext [as 别名]
 def close(self):
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     if self.buffer:
         wc.puttext(self.sx, self.sy, self.ex, self.ey, self.buffer)
开发者ID:chyser,项目名称:bin,代码行数:6,代码来源:conio.py


注:本文中的WConio.puttext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。