daily pastebin goal
28%
SHARE
TWEET

Untitled

a guest Oct 16th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. M = [[0 for j in range(5)] for i in range(4)]
  2.   for i in range(4):
  3.      for j in range(5):
  4.         M[i][j] = int(self.textEdit_1.toPlainText())
  5.    
  6. n = 1
  7.   for i in range(4):
  8.      for j in range(5):
  9.         M[i][j] = exec('int(self.textEdit_{}.toPlainText())'.format(n))
  10.         n += 1
  11.    
  12. n = 1
  13.   for i in range(4):
  14.      for j in range(5):
  15.         M[i][j] = eval('int(self.textEdit_{}.toPlainText())'.format(n))
  16.         n += 1
  17.    
  18. M = [[0 for j in range(5)] for i in range(4)]
  19. n = 0
  20. for i in range(4):
  21.     for j in range(5):
  22.         M[i][j] = listTextEdit[i+j+n]
  23.     n += 4
  24.    
  25. [[1, 2, 3, 4, 5],
  26. [6, 7, 8, 9, 10],
  27. [11, 12, 13, 14, 15],
  28. [16, 17, 18, 19, 20]]
  29.    
  30. import sys
  31. from PyQt5.QtWidgets import *
  32.  
  33. class MainWindow(QMainWindow):
  34.     def __init__(self, parent=None):
  35.         super(MainWindow, self).__init__(parent)
  36.  
  37.         for n in range(1, 21):
  38.             exec('self.textEdit_{0} = QTextEdit("{0}")'.format(n))
  39.  
  40.         M = [[0 for j in range(5)] for i in range(4)]
  41.  
  42.         n = 1
  43.         for i in range(4):
  44.             for j in range(5):
  45.                 exec('M[i][j] =self.textEdit_{0}.toPlainText()'.format(n))
  46.                 n += 1  
  47.  
  48.         for i in range(4):
  49.             print(M[i])    
  50.             #label = QLabel("{}".format(i), self)
  51.             line = ", ".join([ str(j) for j in M[i]])
  52.             label = QLabel(line, self)
  53.             label.move(20, i*10)
  54.  
  55. if __name__ == "__main__":
  56.     app = QApplication(sys.argv)
  57.     w = MainWindow()
  58.     w.show()
  59.     sys.exit(app.exec_())
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top