This is the line that helps me plot on python.
packing_options[best_index].plot_sheets()
This is how it looks on python. This is the picture of the graph. https://i.stack.imgur.com/zcVXJ.jpg
Now, I am trying tkinter. I want the graph to pop up. How can I do this ?
window = tk.Tk()
packing_options[best_index].plot_sheets()
window.mainloop()
I tried this. But didn t work.
Edited : So, "matplotlib is to be used as someone commented. Here is the code :
def plot_sheet(self):
fig,ax = plt.subplots(1)
ax.set_xlim([0, self.W])
ax.set_ylim([0, self.L])
recs = []
for i in range(len(self.rect_list)):
if self.rect_rotate[i]:
ax.add_patch(patches.Rectangle((self.rect_pos[i][0], self.rect_pos[i][1]), self.rect_list[i].l, self.rect_list[i].w,linewidth=3,edgecolor='r'))
else:
ax.add_patch(patches.Rectangle((self.rect_pos[i][0], self.rect_pos[i][1]), self.rect_list[i].w, self.rect_list[i].l,linewidth=3,edgecolor='r'))
plt.show()
def plot_sheets(self):
for i in range(len(self.sheets)):
self.sheets[i].plot_sheet()
this is the code for plotting. packing_options[best_index] is also a function here. and it plots around 10-20 plots as there is a loop. How do I apply matplotlib backend here?