當前位置: 首頁>>代碼示例>>Python>>正文


Python FlagPainter.draw_rectangle方法代碼示例

本文整理匯總了Python中FlagPainter.FlagPainter.draw_rectangle方法的典型用法代碼示例。如果您正苦於以下問題:Python FlagPainter.draw_rectangle方法的具體用法?Python FlagPainter.draw_rectangle怎麽用?Python FlagPainter.draw_rectangle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FlagPainter.FlagPainter的用法示例。


在下文中一共展示了FlagPainter.draw_rectangle方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: paint_flag_montenegro

# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import draw_rectangle [as 別名]
def paint_flag_montenegro():
    """http://www.vexilla-mundi.com/montenegro_flag.html"""
    f = FlagPainter(1 / 2)
    colors = [(283, 12, 43), (254, 191, 37)]
    f.background(colors[1])
    f.draw_rectangle(box=(3 / 120, 3 / 60, 1 - 3 / 120, 1 - 3 / 60), color=colors[0])
    f.place_drawing('montenegro_detail', (1 / 2, 1 / 2), (None, 40 / 60))
    f.save('montenegro')
開發者ID:physicalattraction,項目名稱:PythonPainting,代碼行數:10,代碼來源:FlagRecipes.py

示例2: paint_flag_switzerland

# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import draw_rectangle [as 別名]
def paint_flag_switzerland():
    """http://vexilla-mundi.com/switserland_flag.html"""
    f = FlagPainter(1 / 1)
    colors = [(197, 5, 50), (255, 255, 255)]
    f.background(colors[0])

    out_lu = 6 / 32
    in_lu = 13 / 32
    out_rl = 26 / 32
    in_rl = 19 / 32
    horizontal_box = (out_lu, in_lu, out_rl, in_rl)
    vertical_box = (in_lu, out_lu, in_rl, out_rl)
    f.draw_rectangle(horizontal_box, colors[1])
    f.draw_rectangle(vertical_box, colors[1])
    f.save('switzerland')
開發者ID:physicalattraction,項目名稱:PythonPainting,代碼行數:17,代碼來源:FlagRecipes.py

示例3: paint_flag_greece

# 需要導入模塊: from FlagPainter import FlagPainter [as 別名]
# 或者: from FlagPainter.FlagPainter import draw_rectangle [as 別名]
def paint_flag_greece():
    f = FlagPainter(2 / 3)
    colors = [(0, 36, 151), (255, 255, 255)]

    # Draw the stripes
    band_colors = colors * 5
    band_colors = band_colors[0:9]
    ratios = [1] * 9
    f.stripes(band_colors, ratios, StripeDirection.horizontal)

    # Draw the upper box
    box = (0, 0, 10 / 27, 10 / 18)
    f.draw_rectangle(box, colors[0])
    box = (4 / 27, 0, 6 / 27, 10 / 18)
    f.draw_rectangle(box, colors[1])
    box = (0, 4 / 18, 10 / 27, 6 / 18)
    f.draw_rectangle(box, colors[1])

    # Fix the white band under the box, because we are one pixel off
    f.draw_horizontal_band((10 / 18, 12 / 18), colors[1])

    f.save('greece')
開發者ID:physicalattraction,項目名稱:PythonPainting,代碼行數:24,代碼來源:FlagRecipes.py


注:本文中的FlagPainter.FlagPainter.draw_rectangle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。