Skip to content

New stlye qt calls #2382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Sep 10, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pep8 fixes
  • Loading branch information
tacaswell committed Sep 5, 2013
commit bf3b1b45b3714ebb29d72e6f8be94e7ee279e729
10 changes: 6 additions & 4 deletions examples/user_interfaces/embedding_in_qt4.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
# may be distributed without limitation.

from __future__ import unicode_literals
import sys, os, random
import sys
import os
import random
from matplotlib.backends import qt4_compat
use_pyside = qt4_compat.QT_API == qt4_compat.QT_API_PYSIDE
if use_pyside:
Expand Down Expand Up @@ -62,18 +64,18 @@ class MyDynamicMplCanvas(MyMplCanvas):
def __init__(self, *args, **kwargs):
MyMplCanvas.__init__(self, *args, **kwargs)
timer = QtCore.QTimer(self)
if use_pyside:
if use_pyside:
timer.timeout.connect(self.update_figure)
else:
QtCore.QObject.connect(timer, QtCore.SIGNAL("timeout()"), self.update_figure)
timer.start(1000)

def compute_initial_figure(self):
self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r')
self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r')

def update_figure(self):
# Build a list of 4 random integers between 0 and 10 (both inclusive)
l = [ random.randint(0, 10) for i in range(4) ]
l = [random.randint(0, 10) for i in range(4)]

self.axes.plot([0, 1, 2, 3], l, 'r')
self.draw()
Expand Down