Skip to content

Instantly share code, notes, and snippets.

@WhoSayIn
Created April 8, 2011 01:47
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save WhoSayIn/909143 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'untitled.ui'
#
# Created: Thu Mar 31 00:12:41 2011
# by: PyQt4 UI code generator 4.8.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
import sys
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_Pencere(object):
islem = sayi1 = sayi2 = 0
# 1 toplama 2 çıkarma 3 çarpma 4 bölme 0 boş
# metin kutusuna rakam ekler
def ekle(self, sayi):
if (sayi == "0"):
if (ui.txtSonuc.text() != ""):
ui.txtSonuc.setText(ui.txtSonuc.text()+"0")
else:
ui.txtSonuc.setText(ui.txtSonuc.text()+str(sayi))
# metin kutusunu temizler
def temizle(self):
ui.txtSonuc.setText("")
self.islem = self.sayi1 = self.sayi2 = 0
# metin kutusundaki sayıyı sayi1 değişkenine atar ve metin kutusunu temizler
def hsp(self):
self.sayi1 = int(ui.txtSonuc.text())
ui.txtSonuc.setText("")
# toplama
def topla(self):
self.islem = 1
self.hsp()
# çıkarma
def cikar(self):
self.islem = 2
self.hsp()
# çarpma
def carp(self):
self.islem = 3
self.hsp()
# bölme
def bol(self):
self.islem = 4
self.hsp()
# islem değişkenine bakıp sayi1 ve sayi2 değişkenine uygun işlemi uygular
def esittir(self):
if (ui.txtSonuc.text() != ""):
self.sayi2 = int(ui.txtSonuc.text())
if (self.islem == 1):
ui.txtSonuc.setText(str(self.sayi1 + self.sayi2))
if (self.islem == 2):
ui.txtSonuc.setText(str(self.sayi1 - self.sayi2))
if (self.islem == 3):
ui.txtSonuc.setText(str(self.sayi1 * self.sayi2))
if (self.islem == 4):
ui.txtSonuc.setText(str(self.sayi1 / self.sayi2))
self.islem = self.sayi1 = self.sayi2 = 0
# Hakkında
def hakkinda(self):
a = QtGui.QMessageBox()
a.setWindowTitle(u"Hakkında")
a.setText(u"HK Hesap v0.1")
a.setInformativeText(u"""Hüseyin KELEŞ - 2011
http://www.whosayin.com""")
a.exec_()
def setupUi(self, Pencere):
Pencere.setObjectName(_fromUtf8("Pencere"))
Pencere.resize(209, 250)
font = QtGui.QFont()
font.setWeight(75)
font.setBold(True)
Pencere.setFont(font)
self.centralwidget = QtGui.QWidget(Pencere)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.txtSonuc = QtGui.QLineEdit(self.centralwidget)
self.txtSonuc.setGeometry(QtCore.QRect(10, 0, 191, 31))
self.txtSonuc.setMaxLength(15)
self.txtSonuc.setReadOnly(True)
self.txtSonuc.setObjectName(_fromUtf8("txtSonuc"))
self.pushButton = QtGui.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(10, 40, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton.setFont(font)
self.pushButton.setObjectName(_fromUtf8("pushButton"))
self.pushButton_2 = QtGui.QPushButton(self.centralwidget)
self.pushButton_2.setGeometry(QtCore.QRect(60, 40, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton_2.setFont(font)
self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
self.pushButton_3 = QtGui.QPushButton(self.centralwidget)
self.pushButton_3.setGeometry(QtCore.QRect(110, 40, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton_3.setFont(font)
self.pushButton_3.setObjectName(_fromUtf8("pushButton_3"))
self.pushButton_4 = QtGui.QPushButton(self.centralwidget)
self.pushButton_4.setGeometry(QtCore.QRect(10, 80, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton_4.setFont(font)
self.pushButton_4.setObjectName(_fromUtf8("pushButton_4"))
self.pushButton_5 = QtGui.QPushButton(self.centralwidget)
self.pushButton_5.setGeometry(QtCore.QRect(60, 80, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton_5.setFont(font)
self.pushButton_5.setObjectName(_fromUtf8("pushButton_5"))
self.pushButton_6 = QtGui.QPushButton(self.centralwidget)
self.pushButton_6.setGeometry(QtCore.QRect(110, 80, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton_6.setFont(font)
self.pushButton_6.setObjectName(_fromUtf8("pushButton_6"))
self.pushButton_7 = QtGui.QPushButton(self.centralwidget)
self.pushButton_7.setGeometry(QtCore.QRect(10, 120, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton_7.setFont(font)
self.pushButton_7.setObjectName(_fromUtf8("pushButton_7"))
self.pushButton_8 = QtGui.QPushButton(self.centralwidget)
self.pushButton_8.setGeometry(QtCore.QRect(60, 120, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton_8.setFont(font)
self.pushButton_8.setObjectName(_fromUtf8("pushButton_8"))
self.pushButton_C = QtGui.QPushButton(self.centralwidget)
self.pushButton_C.setGeometry(QtCore.QRect(60, 160, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton_C.setFont(font)
self.pushButton_C.setObjectName(_fromUtf8("pushButton_C"))
self.pushButton_9 = QtGui.QPushButton(self.centralwidget)
self.pushButton_9.setGeometry(QtCore.QRect(110, 120, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton_9.setFont(font)
self.pushButton_9.setObjectName(_fromUtf8("pushButton_9"))
self.pushButton_11 = QtGui.QPushButton(self.centralwidget)
self.pushButton_11.setGeometry(QtCore.QRect(10, 160, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton_11.setFont(font)
self.pushButton_11.setObjectName(_fromUtf8("pushButton_11"))
self.pushButton_10 = QtGui.QPushButton(self.centralwidget)
self.pushButton_10.setGeometry(QtCore.QRect(160, 40, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton_10.setFont(font)
self.pushButton_10.setObjectName(_fromUtf8("pushButton_10"))
self.pushButton_12 = QtGui.QPushButton(self.centralwidget)
self.pushButton_12.setGeometry(QtCore.QRect(160, 80, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton_12.setFont(font)
self.pushButton_12.setObjectName(_fromUtf8("pushButton_12"))
self.pushButton_13 = QtGui.QPushButton(self.centralwidget)
self.pushButton_13.setGeometry(QtCore.QRect(160, 120, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton_13.setFont(font)
self.pushButton_13.setObjectName(_fromUtf8("pushButton_13"))
self.pushButton_14 = QtGui.QPushButton(self.centralwidget)
self.pushButton_14.setGeometry(QtCore.QRect(160, 160, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton_14.setFont(font)
self.pushButton_14.setObjectName(_fromUtf8("pushButton_14"))
self.pushButton_15 = QtGui.QPushButton(self.centralwidget)
self.pushButton_15.setGeometry(QtCore.QRect(110, 160, 41, 31))
font = QtGui.QFont()
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.pushButton_15.setFont(font)
self.pushButton_15.setObjectName(_fromUtf8("pushButton_15"))
self.pushButton_16 = QtGui.QPushButton(self.centralwidget)
self.pushButton_16.setGeometry(QtCore.QRect(10, 200, 91, 24))
self.pushButton_16.setObjectName(_fromUtf8("pushButton_16"))
self.pushButton_17 = QtGui.QPushButton(self.centralwidget)
self.pushButton_17.setGeometry(QtCore.QRect(110, 200, 91, 24))
self.pushButton_17.setObjectName(_fromUtf8("pushButton_17"))
Pencere.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(Pencere)
self.menubar.setGeometry(QtCore.QRect(0, 0, 209, 21))
self.menubar.setObjectName(_fromUtf8("menubar"))
Pencere.setMenuBar(self.menubar)
self.statusbar = QtGui.QStatusBar(Pencere)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
Pencere.setStatusBar(self.statusbar)
self.action_k = QtGui.QAction(Pencere)
self.action_k.setObjectName(_fromUtf8("action_k"))
self.retranslateUi(Pencere)
QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("clicked()")), lambda i="1": self.ekle(i))
QtCore.QObject.connect(self.pushButton_2, QtCore.SIGNAL(_fromUtf8("clicked()")), lambda i="2": self.ekle(i))
QtCore.QObject.connect(self.pushButton_3, QtCore.SIGNAL(_fromUtf8("clicked()")), lambda i="3": self.ekle(i))
QtCore.QObject.connect(self.pushButton_4, QtCore.SIGNAL(_fromUtf8("clicked()")), lambda i="4": self.ekle(i))
QtCore.QObject.connect(self.pushButton_5, QtCore.SIGNAL(_fromUtf8("clicked()")), lambda i="5": self.ekle(i))
QtCore.QObject.connect(self.pushButton_6, QtCore.SIGNAL(_fromUtf8("clicked()")), lambda i="6": self.ekle(i))
QtCore.QObject.connect(self.pushButton_7, QtCore.SIGNAL(_fromUtf8("clicked()")), lambda i="7": self.ekle(i))
QtCore.QObject.connect(self.pushButton_8, QtCore.SIGNAL(_fromUtf8("clicked()")), lambda i="8": self.ekle(i))
QtCore.QObject.connect(self.pushButton_9, QtCore.SIGNAL(_fromUtf8("clicked()")), lambda i="9": self.ekle(i))
QtCore.QObject.connect(self.pushButton_11, QtCore.SIGNAL(_fromUtf8("clicked()")), lambda i="0": self.ekle(i))
QtCore.QObject.connect(self.pushButton_13, QtCore.SIGNAL(_fromUtf8("clicked()")), self.carp)
QtCore.QObject.connect(self.pushButton_12, QtCore.SIGNAL(_fromUtf8("clicked()")), self.cikar)
QtCore.QObject.connect(self.pushButton_10, QtCore.SIGNAL(_fromUtf8("clicked()")), self.topla)
QtCore.QObject.connect(self.pushButton_15, QtCore.SIGNAL(_fromUtf8("clicked()")), self.esittir)
QtCore.QObject.connect(self.pushButton_14, QtCore.SIGNAL(_fromUtf8("clicked()")), self.bol)
QtCore.QObject.connect(self.pushButton_17, QtCore.SIGNAL(_fromUtf8("clicked()")), Pencere.close)
QtCore.QObject.connect(self.pushButton_16, QtCore.SIGNAL(_fromUtf8("clicked()")), self.hakkinda)
QtCore.QObject.connect(self.pushButton_C, QtCore.SIGNAL(_fromUtf8("clicked()")), self.temizle)
QtCore.QMetaObject.connectSlotsByName(Pencere)
def retranslateUi(self, Pencere):
Pencere.setWindowTitle(QtGui.QApplication.translate("Pencere", "HK Hesap", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton.setText(QtGui.QApplication.translate("Pencere", "1", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_2.setText(QtGui.QApplication.translate("Pencere", "2", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_3.setText(QtGui.QApplication.translate("Pencere", "3", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_4.setText(QtGui.QApplication.translate("Pencere", "4", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_5.setText(QtGui.QApplication.translate("Pencere", "5", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_6.setText(QtGui.QApplication.translate("Pencere", "6", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_7.setText(QtGui.QApplication.translate("Pencere", "7", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_8.setText(QtGui.QApplication.translate("Pencere", "8", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_9.setText(QtGui.QApplication.translate("Pencere", "9", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_11.setText(QtGui.QApplication.translate("Pencere", "0", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_10.setText(QtGui.QApplication.translate("Pencere", "+", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_12.setText(QtGui.QApplication.translate("Pencere", "-", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_13.setText(QtGui.QApplication.translate("Pencere", "*", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_14.setText(QtGui.QApplication.translate("Pencere", "/", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_15.setText(QtGui.QApplication.translate("Pencere", "=", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_C.setText(QtGui.QApplication.translate("Pencere", "C", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_16.setText(QtGui.QApplication.translate("Pencere", "Hakkında", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_17.setText(QtGui.QApplication.translate("Pencere", "Çıkış", None, QtGui.QApplication.UnicodeUTF8))
self.action_k.setText(QtGui.QApplication.translate("Pencere", "Çıkış", None, QtGui.QApplication.UnicodeUTF8))
app = QtGui.QApplication(sys.argv)
window = QtGui.QMainWindow()
ui = Ui_Pencere()
ui.setupUi(window)
window.show()
sys.exit(app.exec_())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment