国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python實現360的字符顯示界面

2020-02-23 05:10:57
字體:
來源:轉載
供稿:網友

代碼如下:
#!/usr/bin/python 
#-*-coding:utf-8-*-

from push_button import *
from clabel import *
from common import *

from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.Qt import *


class CharacterWidget(QWidget):
 def __init__(self,parent = None):
  super(CharacterWidget,self).__init__()
  self.mouse_press = False
  self.mouse_move = False
  self.current_index = 0 #當前圖片下標
  self.current_pos_x = 0
  #self.name_list = QStringList()
  self.m_mouseSrcPos = QPoint()
  self.m_mouseDstPos = QPoint()
  self.label_move = False
  self.label_array = [CLabel(),CLabel(),CLabel(),CLabel()] #存儲圖片的數組

  self.resize(QSize(WINDOW_WIDTH, WINDOW_HEIGHT))
  self.setWindowFlags(Qt.FramelessWindowHint)

  self.background_label =  QLabel(self) #背景圖片
  self.background_label.setPixmap(QPixmap("./img/Character/bg_bottom.png"))
  self.background_label.setGeometry(QRect(0, 0, self.width(), self.height()))

  #將4張圖片合成一張
  self.pixmap = QPixmap(QSize(self.width()*WINDOW_PAGE_COUNT, WINDOW_HEIGHT)) #
  painter  = QPainter(self.pixmap)
  for i  in range(WINDOW_PAGE_COUNT):
   painter.drawImage(QRect(WINDOW_WIDTH*i, 0, WINDOW_WIDTH, WINDOW_HEIGHT),/
    QImage(QString("./img/Character/desktop_%1").arg(i)))
  self.total_label =  QLabel(self) #圖片(結合體)
  self.total_label.resize(self.pixmap.size())
  self.total_label.setPixmap(self.pixmap)
  self.total_label.move(WINDOW_START_X, WINDOW_START_Y)

  self.close_button =  PushButton(self)  #關閉按鈕
  self.translateLanguage()
  for i in range(WINDOW_BUTTON_COUNT):
   self.label =  CLabel(self)
   self.label.resize(QSize(155, 45))
   self.label.setPixmap(QPixmap(QString("./img/Character/btn_%1").arg(i)))
   self.label.setText(self.name_list[i])
   self.label.move(8+i*170, 319)
   self.connect(self.label, SIGNAL("clicked()"), self, SLOT("changeCurrentPage(CLabel())"))
   self.label_array[i] = self.label
  self.label_array[0].setMousePressFlag(False)

  self.close_button.loadPixmap("./img/sysButton/close.png")
  self.close_button.move(self.width()-52, 0)
  self.connect(self.close_button, SIGNAL("clicked()"), self, SLOT("close()"))


 def translateLanguage(self):
  self.name_list= [u"function",u"clear cookie",u"triggerman",u"booster"]
  self.close_button.setToolTip(u"close")

 def mousePressEvent(self,event):
  if(event.button() == Qt.LeftButton):

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 康平县| 海伦市| 和林格尔县| 镇康县| 铜陵市| 林芝县| 常宁市| 洪江市| 南投市| 柳河县| 邻水| 新余市| 岚皋县| 正镶白旗| 崇州市| 临桂县| 灵璧县| 长武县| 唐河县| 海城市| 金塔县| 濮阳市| 英吉沙县| 新晃| 济阳县| 边坝县| 台北县| 和顺县| 云南省| 屏东市| 肃北| 长顺县| 山西省| 原阳县| 常德市| 迁安市| 无为县| 抚松县| 梅河口市| 阳江市| 旺苍县|