Show More
@@ -5,6 +5,12 b' In [1]: %gui [backend]' | |||||
5 | In [2]: %run switchgui [backend] |
|
5 | In [2]: %run switchgui [backend] | |
6 |
|
6 | |||
7 | where the optional backend can be one of: qt4, gtk, tk, wx. |
|
7 | where the optional backend can be one of: qt4, gtk, tk, wx. | |
|
8 | ||||
|
9 | Because of subtle difference in how Matplotlib handles the different GUI | |||
|
10 | toolkits (in things like draw and show), minor modifications to this script | |||
|
11 | have to be made for Tk to get it to work with the 0.99 and below releases | |||
|
12 | of Matplotlib. However, in the future, Matplotlib should be able to have | |||
|
13 | similar logic for all the toolkits, as they are all now using PyOS_InputHook. | |||
8 | """ |
|
14 | """ | |
9 |
|
15 | |||
10 | import sys |
|
16 | import sys | |
@@ -34,7 +40,7 b' x = np.linspace(0,pi,500)' | |||||
34 |
|
40 | |||
35 | print "A plot has been created" |
|
41 | print "A plot has been created" | |
36 | line, = plot(x,sin(2*x)) |
|
42 | line, = plot(x,sin(2*x)) | |
37 | inputhook.spin() |
|
43 | inputhook.spin() # This has to be removed for Tk | |
38 |
|
44 | |||
39 |
|
45 | |||
40 | print "Now, we will update the plot..." |
|
46 | print "Now, we will update the plot..." | |
@@ -45,4 +51,4 b' for i in range(1,51):' | |||||
45 | line.set_data(x,sin(x*i)) |
|
51 | line.set_data(x,sin(x*i)) | |
46 | plt.title('i=%d' % i) |
|
52 | plt.title('i=%d' % i) | |
47 | plt.draw() |
|
53 | plt.draw() | |
48 | inputhook.spin() |
|
54 | inputhook.spin() # This has to be removed for Tk |
General Comments 0
You need to be logged in to leave comments.
Login now