小编Mic*_*ael的帖子

Qwidget窗口消失了

好的......这已经困扰了我几个小时.我有一个带菜单栏的qtmainwindow.我已经设法将tje菜单栏中的动作连接到一个独立的Qwidget.但是一旦Qwidget出现就消失了.我正在使用最新版本的pyqt.

这是代码:

Import sys
from PyQt4  import QtGui,  QtCore

Class Main(QtGui.QtMainWindow) :
         def __init__(self) :
               QtGui.QtMainWindow.__init__(self) 
               self.setGeometry(300,300,240,320) 
               self.show() 

               menubar  = self. menuBar() 

               filemenu = menubar. addMenu('&File') 

               new = QtGui.QAction(QtGui.QIcon('new.png'), 'New', self) 
               new.triggered.connect(self.pop) 
               filemenu.addAction(new) 

      def pop(self) :
            pop = Pop() 

class Pop(QtGui.QWidget) :
         def __init__(self) :
               QtGui.QWidget.__init__(self) 
              self.setGeometry(300,300,240,320>
              self.setWindowTitle('Pop up') 
             self.show() 
Run Code Online (Sandbox Code Playgroud)

pyqt4

2
推荐指数
1
解决办法
2467
查看次数

使用time.sleep()在同一行上打印

我正在尝试使用两者之间的计时器在同一行上打印两个字符串.这是代码:

import time

print "hello",
time.sleep(2)
print "world"
Run Code Online (Sandbox Code Playgroud)

但似乎程序等待两秒然后打印两个字符串.

python python-2.7

2
推荐指数
2
解决办法
2723
查看次数

Laravel 5.4验证器没有看到输入字段

所以我正在尝试使用Validator外观设置验证.出于某些奇怪的原因,验证器没有看到其中一个输入字段,尽管它存在于请求中.这是验证码:

        $rules = [
            'name'          => 'required',
            'resource_type' => 'required',
            'semester'      => 'required',
            'file'          => 'required|max:8196'
        ];
        $messages = [
            'name.required' => 'The name field is required',
            'semester.required' => 'The semester field is required',
            'resource_type.required' => 'The resource_type field is required',
            'file.required' => 'The file field is required',
            'file.max' => 'The max file size is 8196 kilobytes',
        ];

        $validator = Validator::make($request->input(), $rules, $messages);
        if ($validator->fails()) {
            return response()->json($validator->messages(), 422);
        }
Run Code Online (Sandbox Code Playgroud)

这是我正在运行的测试:

$file = UploadedFile::fake()->create('file.pdf', 512);
    $response = $this->json( …
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-5.4

2
推荐指数
1
解决办法
111
查看次数

标签 统计

laravel ×1

laravel-5.4 ×1

php ×1

pyqt4 ×1

python ×1

python-2.7 ×1