2
'' '내 코드가 matplotlib 창을 열고 matplotlib 창을 종료 한 후 tkinter하지만 tkinter 창이 열립니다. 나는 동시에 팝업 둘 다 원하는 '' 'matplotlib 윈도우와 동시에 tkinter 창을 열고 싶습니까?
from pylab import *
import matplotlib.pyplot as plt
from matplotlib import style
import numpy as np
import pylab
style.use('seaborn-white')
x = [0,8,-3,-8]
y = [0,8,1,-8]
color=['w','w','w','w']
fig = plt.figure()
ax1 = fig.add_subplot(111)
scatter(x,y, s=100 ,marker='.', c=color,edgecolor='w')
plt.ylabel('X')
plt.xlabel('Y')
ax1.yaxis.label.set_rotation(0)
circle1=plt.Circle((0,0),5,color='r',fill=False,linewidth='4')
fig = plt.gcf()
fig.gca().add_artist(circle1)
left,right = ax1.get_xlim()
low,high = ax1.get_ylim()
arrow(left, 0, right -left, 0, length_includes_head = True, head_width = 0.15)
arrow(0, low, 0, high-low, length_includes_head = True, head_width = 0.15)
fig = pylab.gcf()
fig.canvas.set_window_title('Inner Slip Ring')
grid()
show()
from tkinter import *
root=Tk()
w=Label(root, text="hello")
w.pack()
root.mainloop()
감사합니다하지만 당신은 루트를 사용하지 않는 이유를 말해주십시오 수 있습니다. mainloop – thedarkgriffen
주 루프를 시작하면 프로그램이 해당 행에서 중지됩니다. 루트가 파기 될 때까지 기다립니다 (창을 닫을 때). mainloop은 이벤트를 검사하는 무한 루프이며 응용 프로그램에서 한 번만 호출해야합니다 (show()로 그렇게 함). –