将图像添加到python中的星形打印

问题描述

如何在GUI(Tkinter)上打印此图像,以便可以将图像添加到其背景中,或者是否有其他方法可以将图像添加到该程序中? 我曾尝试在Tkinter上导入它,但不知道如何在其中打印出来

# List for the loop print star message
print_H=[[" " for i in range(6)]for j in range(6)]
print_A=[[" " for i in range(6)]for j in range(6)]
print_P=[[" " for i in range(6)]for j in range(6)]
print_Y=[[" " for i in range(6)]for j in range(6)]

# Loop for H "*" pattern 
for r in range(6):
    for c in range(6):
        if c == 0 or c == 5 or (r ==  3 and (c>0 and c <5)):
            print_H[r][c]="*"

# Loop for A "*" pattern
for r in range(6):
    for c in range(6):
        if ((c == 0 or c==5) and  r!=0)  or (r==0 and(c>0 and c<5)) or (r==3  and(c>0 and c<5)) :
            print_A[r][c]="*"

# Loop for P"*" pattern
for r in range(6):
    for c in range(6):
        if c==0 or (c==4 and (r==1 or r==2)) or ((r==0 or r==3) and (c>0 and c<4)) :
            print_P[r][c]="*"

# Loop for Y "*" pattern
for r in range(6):
    for c in range(6):
        if (c==2 and r>1) or (r==c and c<2) or (r==0 and c==4) or (r==1 and c==3) :
            print_Y[r][c]="*"

# This will print all star("*") in the message form       
for i in range(6):
    for j in range(6):
        print(print_H[i][j],end=" ")
    for j in range(6):
        print(print_A[i][j],end=" ")
    for j in range(6):
        print(print_P[i][j],end=" ")
    for j in range(6):
        print(print_Y[i][j],end=" ")
    print( )

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)