[PySide] Question from a newbie

Aaron Richiger a.richi at bluewin.ch
Tue Dec 24 11:14:08 CET 2013


Hello Vojtech

Impressive what you are able to do!!! I can't find my bugs with good 
eyes and have no idea how one would find them without seeing the code. I 
changed a few things in your file and hope, the resulting solution fits 
your needs:

- fixed rowCount of your sudoku (was 10, now 9)
- overwrote QPushButton and QSpinBox to store their index and to 
implement custom keyPressEvent behaviour
- navigate using arrows, start editing by hitting enter or return.
- change value of the spinbox using arrows, finish editing by hitting 
enter, continue navigating

I hope this helps! If you have further questions, feel free to ask again!

Merry Christmas! Aaron





Am 22.12.2013 18:15, schrieb Vojtěch Polášek:
> Greetings,
> my name is Vojtěch Polášek and I am a blind student from czech Republic.
> I am creating an application in Pyside with Python 3.2. I would like to
> create a sudoku game accessible for blind and visually impaired people.
> I have created a main window, added a widget which contains 81 buttons
> in a grid layout. Now my idea is, that after pressing a button, that
> button would disappear and would be replaced by some other controll
> which would allow you to change the value. I chose QSpinBox for now.
> This step works well, although I had to implement my own eventfilter,
> because QT in Linux uses arrows to browse available elements on the
> screen. Never mind.
> Now this is the way in which I replace a button with a spinbox. This
> function is connected to the QPushButton.clicked signal:
>      def editValue(self):
>          print ('editing')
>          senderpos =
> self.grid.getItemPosition(self.grid.indexOf(self.sender()))
>          self.grid.addWidget(self.spinbox, senderpos[0], senderpos[1])
>          print ('added')
>          self.spinbox.setValue(int(self.sender().text()))
>          print ('value set')
>          self.spinbox.show()
>          print('showed')
>          self.spinbox.setFocus()
>          print('focused')
>          self.spinbox.editingFinished.connect(self.storeValue)
>          print('connected')
>
> Don't mind those print statements, they are there for debugging
> purposes, because I haven't found a way of debugging Pyside with PDB.
> The problem is, that this signal is also called after I press a button
> and this function is executed. I don't manipulate with spinbox in any
> manner. Only thing that is set is its accepted range of input.
> What could be the problem?
> I am attaching the source code.
> Thank you very much,
> Vojtěch Polášek
>
>
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20131224/dde1ed6c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: layout.py
Type: text/x-python
Size: 3413 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20131224/dde1ed6c/attachment.py>


More information about the PySide mailing list