workdays.c

  name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-5572165936844014&dt=1194442938015&lmt=1194190197&format=336x280_as&output=html&correlator=1194442937843&url=file%3A%2F%2F%2FC%3A%2FDocuments%2520and%2520Settings%2Flhh1%2F%E6%A1%8C%E9%9D%A2%2FCLanguage.htm&color_bg=FFFFFF&color_text=000000&color_link=000000&color_url=FFFFFF&color_border=FFFFFF&ad_type=text&ga_vid=583001034.1194442938&ga_sid=1194442938&ga_hid=1942779085&flash=9&u_h=768&u_w=1024&u_ah=740&u_aw=1024&u_cd=32&u_tz=480&u_java=true" frameborder="0" width="336" scrolling="no" height="280" allowtransparency="allowtransparency"> #include <stdio.h>

void main(void)
 {
   char *workdays[] = {"Monday", "Tuesday", "Wednesday",
                        "Thursday", "Friday", "" };
   char **work_day;

   work_day = workdays;

   while (*work_day)
     printf("%s/n", *work_day++);
 }

 

from PyQt5.QtCore import QTimer, QDateTime, QPropertyAnimation, QEasingCurve, pyqtProperty from PyQt5.Qt import * from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QMainWindow, QLabel, QLineEdit, QPushButton, QApplication, QDialog import sys import time class AnimatedLabel(QLabel): def __init__(self, text="", parent=None): # def __init__(self, text=""): super().__init__(text, parent) # super().__init__(text) self.setFontSize(25) # 设置初始字体大小 self._font_size = 25 # 内部变量用于动画控制 @pyqtProperty(int) def fontSize(self): return self._font_size @fontSize.setter def fontSize(self, value): self._font_size = value self.setFontSize(value) def setFontSize(self, size): font = self.font() font.setPointSize(size) self.setFont(font) class Mainwindow(QMainWindow): def __init__(self): super(Mainwindow, self).__init__() self.start_time = None self.resize(440, 430) # self.setWindowTitle('实时薪资计数器') self.setWindowFlag(Qt.FramelessWindowHint) self.setStyleSheet("font-family: Microsoft YaHei UI;") self.label_salary = QLabel(self) self.label_salary.setText('月薪') self.label_salary.setGeometry(20, 20, 100, 20) self.lineedit_salary = QLineEdit(self) self.lineedit_salary.setGeometry(20, 60, 200, 25) self.label_workdays = QLabel(self) self.label_workdays.setGeometry(20, 105, 200, 20) self.label_workdays.setText('每月工作天数') self.lineedit_workdays = QLineEdit(self) self.lineedit_workdays.setGeometry(20, 145, 200, 25) self.label_workhours = QLabel(self) self.label_workhours.setGeometry(20, 185, 200, 20) self.label_workhours.setText('每天工作小时数') self.lineedit_workhours = QLineEdit(self) self.lineedit_workhours.setGeometry(20, 225, 200, 25) self.button_start = QPushButton(self) self.button_start.setGeometry(70, 265, 100, 30) self.button_start.setStyleSheet(""" QPushButton { background-color: #00BFFF; border-radius: 5px; color: white; font-family: Microsoft YaHei UI; } """) # self.button_start.setStyleSheet("background-color: #00BFFF;") self.button_start.setText('开始计算') self.button_start.clicked.connect(self.calculate_salary) self.button_start.clicked.connect(self.start_timer) # self.label_make_money = QLabel(self) # self.label_make_money.setText('您已赚到:') # self.label_make_money.setGeometry(270, 20, 100, 20) self.label_hour = QLabel(self) self.label_hour.setText('每小时:0.00元') self.label_hour.setGeometry(20, 305, 200, 20) self.label_minute = QLabel(self) self.label_minute.setText('每分钟:0.00元') self.label_minute.setGeometry(20, 345, 200, 20) self.label_second = QLabel(self) self.label_second.setText('每秒钟:0.00元') self.label_second.setGeometry(20, 385, 200, 20) self.spend_time = QLabel(self) self.spend_time.setText('已用时:') self.spend_time.setGeometry(290, 140, 100, 20) self.label_pic_time = QLabel(self) pixmap_time = QPixmap("C:\\Users\\14320\\Downloads\\游戏时间.png") self.label_pic_time.setGeometry(290, 180, 20, 20) self.label_pic_time.setPixmap(pixmap_time) self.label_pic_time.setScaledContents(True) self.label_spend_time = QLabel(self) self.label_spend_time.setGeometry(320, 180, 200, 20) self.label_spend_time.setStyleSheet(""" QLabel { font-family: Microsoft YaHei UI; font-size: 20px; color: #8AC8FF; font-weight: bold; } """) self.label_spend_time.setText('00:00:00') self.label_make = QLabel(self) self.label_make.setGeometry(290, 240, 100, 20) self.label_make.setText('你已经赚到:') self.label_pic = QLabel(self) pixmap_money = QPixmap("C:\\Users\\14320\\Downloads\\钱袋.png") self.label_pic.setGeometry(290, 280, 30, 40) self.label_pic.setPixmap(pixmap_money) self.label_pic.setScaledContents(True) self.label_money = AnimatedLabel('0.00元', self) self.label_money.setGeometry(330, 280, 100, 40) self.label_money.setStyleSheet(""" QLabel { font-family: Microsoft YaHei UI; font-size: 25px; color: #FF6A48; font-weight: bold; } """) # self.label_money.setText('0.00元') self.timer = QTimer(self) self.timer.timeout.connect(self.update_label) def start_timer(self): if not self.start_time: # 如果计时未开始 self.start_time = QDateTime.currentDateTime() # 记录计时起点 self.timer.start(1000) # 每隔1秒触发一次 self.button_start.setText("停止计时") # 更新按钮文本 else: self.stop_timer() # 如果计时已开始,则停止计时 def stop_timer(self): self.timer.stop() # 停止计时器 self.start_time = None # 重置计时起点 self.label_spend_time.setText("计时已停止") # 更新标签文本 self.button_start.setText("开始计算") # 更新按钮文本 self.label_money.setText('0.00元') self.label_hour.setText('每小时:0.00元') self.label_minute.setText('每分钟:0.00元') self.label_second.setText('每秒钟:0.00元') def update_label(self): if self.start_time: elapsed_time = QDateTime.currentDateTime().toSecsSinceEpoch() - self.start_time.toSecsSinceEpoch() elapsed_second = elapsed_time % 60 elapsed_minute = elapsed_time // 60 % 60 elapsed_hour = elapsed_time // 3600 % 24 self.label_spend_time.setText(f"{elapsed_hour:02d}:{elapsed_minute:02d}:{elapsed_second:02d}") money = elapsed_time * self.second self.label_money.setText(f'{money:.2f}元') animation = QPropertyAnimation(self.label_money, b"fontSize", self) animation.setDuration(300) # 动画持续时间 animation.setStartValue(25) # 起始字体大小 animation.setEndValue(50) # 结束字体大小 animation.setEasingCurve(QEasingCurve.OutQuad) # 动画曲线类型 # 在动画结束时恢复字体大小 animation.finished.connect(lambda: self.label_money.setFontSize(25)) animation.start() def calculate_salary(self): self.time_1 = time.time() self.hour = float(self.lineedit_salary.text()) / float(self.lineedit_workdays.text()) / float(self.lineedit_workhours.text()) self.minute = self.hour / 60 self.second = self.minute / 60 self.label_hour.setText(f'每小时:{self.hour:.2f}元') self.label_minute.setText(f'每分钟:{self.minute:.2f}元') self.label_second.setText(f'每秒钟:{self.second:.2f}元') # self.label_spend_time.setText() if __name__ == '__main__': app = QApplication(sys.argv) win = Mainwindow() win.show() sys.exit(app.exec()) 修改一下
06-02
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值