0

縦に並んだ6枚のラベルにきれいにパーツを足して、6分割された絵を再構成しようとしています。写真にはラベル付きの正確なサイズがありますが、ラベルを追加した後でも、ラベルが小さくなるか、画像が本来のサイズになっていないため、画像の部分が結合されていません。これを証明するために、作成した関数を使用して画像を追加する前後にラベルのサイズを確認しました。

画像、サイズ、結果を含むラベルのコード:

Lwidth = 512 #root.winfo_width()
Lheight = 115 #root.winfo_height() // 6

img1=Image.open('row-1.png')

bg1=ImageTk.PhotoImage(img1)
  
l1 = Label(root, image=bg1)
l1.pack(fill='both', expand=True)
l1.image = bg1 
l1.update()


img2=Image.open('row-2.png')

bg2=ImageTk.PhotoImage(img2)
  
l2 = Label(root, image=bg2)
l2.pack(fill='both', expand=True)
l2.image = bg2 
l2.update()


img3=Image.open('row-3.png')

bg3=ImageTk.PhotoImage(img3)
   
l3 = Label(root, image=bg3)
l3.pack(fill='both', expand=True)
l3.image = bg3 
l3.update()


img4=Image.open('row-4.png')

bg4=ImageTk.PhotoImage(img4)
  
l4 = Label(root, image=bg4)
l4.pack(fill='both', expand=True)
l4.image = bg4 
l4.update()


img5=Image.open('row-5.png')

bg5=ImageTk.PhotoImage(img5)
  
l5 = Label(root, image=bg5)
l5.pack(fill='both', expand=True)
l5.image = bg5 
l5.update()


img6=Image.open('row-6.png')

bg6=ImageTk.PhotoImage(img6)
  
l6 = Label(root, image=bg6)
l6.pack(fill='both', expand=True)
l6.image = bg6 
l6.update()

root.update()

ここに画像の説明を入力

結果:

ここに画像の説明を入力

これは、画像なしのコードから作成した関数から得られるものです。

ここに画像の説明を入力

問題が画像にあるのではないと確信しています。いくつかの部分を失うことなく、画像が正しく分割されていることを確認するために、さまざまな方法を試しました...

4

1 に答える 1