May-23-2018, 07:58 AM
hi all,
source code is already implemented and running in windows7 platform using python3.4 and 3.4 it is succesfully output generated
but when i used the same sourcecode in REDHAT7.5 linux python platform it is only displaying filemenu and images but the Touch function is not working
please guide me to resolve this issue sir
Thanks
shridhara s
source code is already implemented and running in windows7 platform using python3.4 and 3.4 it is succesfully output generated
but when i used the same sourcecode in REDHAT7.5 linux python platform it is only displaying filemenu and images but the Touch function is not working
please guide me to resolve this issue sir
Thanks
shridhara s
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.uic import * from types import * from tkinter import * from tkinter import filedialog root = Tk() f1 = filedialog.askopenfilename(filetypes = (( "how" , "*.py" ),( "ha" , "*.jpg" ),( "ha" , "*.png" ),( "all" , "*.*" ))) app = QApplication(sys.argv) w = loadUi( "main1.ui" ) img = QImage(f1) painter = QPainter() scale = 1.0 angle = 1.0 ; transformHistory = QTransform() transformTotal = QTransform() startPoint = QPoint() def handleEvents( self , event): global scale, angle, transformHistory, transformTotal, startPoint if event. type () = = QEvent.Gesture: g = event.gesture(Qt.PinchGesture) if g ! = None : upperLeft = self .mapToGlobal(QPoint()) scale = g.totalScaleFactor() angle = g.totalRotationAngle() centerPoint = g.centerPoint() print ( "centerPoint.x(), centerPoint.y()" ) if g.state() = = Qt.GestureStarted: startPoint = g.centerPoint() transformTotal = transformHistory * QTransform().translate(centerPoint.x(), centerPoint.y()).rotate(angle).scale(scale, scale).translate( - startPoint.x(), - startPoint.y()) if g.state() = = Qt.GestureFinished: transformHistory = transformTotal self .update() else : g = event.gesture(Qt.TapGesture) if g.state() = = Qt.GestureFinished: print ( "tap" ), g.position() transformTotal = QTransform() transformHistory = QTransform() self .update() elif event. type () = = QEvent.Paint: painter.begin( self ) painter.setTransform(transformTotal) #painter.rotate(angle) #painter.scale(scale, scale) painter.drawImage( 0 , 0 , img) painter.end() #print "hello" return True w.widget.event = MethodType(handleEvents, w.widget) w.widget.grabGesture(Qt.PinchGesture) w.widget.grabGesture(Qt.TapGesture) w.show() sys.exit(app.exec_()) |