weixin_44490836
皮皮他爹
采纳率0%
2021-03-09 16:42

PYQT分离出现的print none 求大神帮忙看看

def onButtonClick(self):
    year1 = self.year()
    group1 = self.group()
    print(year1, group1)
def year(self):
    year = self.lineEdit_year.text()
    print(year)
def group(self):
    group = self.lineEdit_group.text()
    print(group)

大神们,我这边是UI转py,想进行分离,提取输入的lineEdit的数值用于其他函数但是,

print(year1, group1)的结果是 none none

求职,我是个小白,正在学习中

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • lechunluo3 Loadinggggg 1月前
    def onButtonClick(self):
        year1 = self.year()
        group1 = self.group()
        print(year1, group1)
    def year(self):
        year = self.lineEdit_year.text()
        print(year)
        return year
    def group(self):
        group = self.lineEdit_group.text()
        print(group)
        return group

    year(),group()要有return,方法调用时,才能获取到值

    点赞 评论 复制链接分享