Mailing List Archive

Free OCR package in Python and selecting appropriate widget for the GUI
Hi Guys
Long time ago I've written a program in Malab a GUI for solving Sudoku puzzles, which worked not so bad.
Now I try to write this GUI with Python with PyQt5 or TKinter.
First question is:
Is there any free OCR software, packages or code in Python, which I can use to recognize the given digits and their positions in the puzzle square.
Second:
Because, I can not attach a picture to this post, I try to describe my picture of my GUI.
It is a 3x3 block / matrix (one third of the whole Sudoku 9x9 block).
This block must be placed three times in row and columns.
Each square of this 3x3 block has 3x3 digits from 1 to 9 at the initialization time. These digits are spread out in 3x3 equal distances. These are small fonts and black.
The values given by the puzzle are red big fonts and not changeable
The digits typed by the user are black big fonts and changeable
If there is a big font from the Puzzle / User, these must be removed from the neighboring fields from the 3x3 matrix (1-9).
Now my question is, actually a hint from your side:
What should I take as widget for one of these small squares to have different content as I described above?
I thought of a QLineEdit in PyQt5 or LineEdit in TKinter, because the user must type some values in there and therefore can not be labels. So again, for the sake of the clarity.
• When the fields are empty, each square has to show digits from 1 to 9 with small fonts in 3x3 matrix order.
• Given values in the puzzle are big fonts and red.
• Digits which are typed by the user are big fonts and black.
Now the question is, can I take only one LineEdit for all these tree situations, or I have to implement 9 small squares for small fonts and a big one for the big fonts?
Any help and suggestion is welcome and appreciated.

Best regards
Mohsen
--
https://mail.python.org/mailman/listinfo/python-list
Re: Free OCR package in Python and selecting appropriate widget for the GUI [ In reply to ]
On 9/21/2021 4:36 AM, Mohsen Owzar wrote:
> Hi Guys
> Long time ago I've written a program in Malab a GUI for solving Sudoku puzzles, which worked not so bad.
> Now I try to write this GUI with Python with PyQt5 or TKinter.
> First question is:
> Is there any free OCR software, packages or code in Python, which I can use to recognize the given digits and their positions in the puzzle square.
> Second:
> Because, I can not attach a picture to this post, I try to describe my picture of my GUI.

Draw your GUI in PyQt designer or other graphics tool, then upload a
screenshot of it to imgur, then post the link to the picture.

--
https://mail.python.org/mailman/listinfo/python-list
Re: Free OCR package in Python and selecting appropriate widget for the GUI [ In reply to ]
DFS schrieb am Dienstag, 21. September 2021 um 15:45:38 UTC+2:
> On 9/21/2021 4:36 AM, Mohsen Owzar wrote:
> > Hi Guys
> > Long time ago I've written a program in Malab a GUI for solving Sudoku puzzles, which worked not so bad.
> > Now I try to write this GUI with Python with PyQt5 or TKinter.
> > First question is:
> > Is there any free OCR software, packages or code in Python, which I can use to recognize the given digits and their positions in the puzzle square.
> > Second:
> > Because, I can not attach a picture to this post, I try to describe my picture of my GUI.
> Draw your GUI in PyQt designer or other graphics tool, then upload a
> screenshot of it to imgur, then post the link to the picture.
Thanks, for your answer.
But, what is "imgur"?
I'm not so familiar with handling of pictures in this group.
How can I call "imgur" or how can I get there?

Regards
Mohsen
--
https://mail.python.org/mailman/listinfo/python-list
Re: Free OCR package in Python and selecting appropriate widget for the GUI [ In reply to ]
imgur.com
Then you upload your image and post a perma-link here in reply.


On Tue, Sep 21, 2021, 22:03 Mohsen Owzar <mohsen.owzar@gmail.com> wrote:

> DFS schrieb am Dienstag, 21. September 2021 um 15:45:38 UTC+2:
> > On 9/21/2021 4:36 AM, Mohsen Owzar wrote:
> > > Hi Guys
> > > Long time ago I've written a program in Malab a GUI for solving Sudoku
> puzzles, which worked not so bad.
> > > Now I try to write this GUI with Python with PyQt5 or TKinter.
> > > First question is:
> > > Is there any free OCR software, packages or code in Python, which I
> can use to recognize the given digits and their positions in the puzzle
> square.
> > > Second:
> > > Because, I can not attach a picture to this post, I try to describe my
> picture of my GUI.
> > Draw your GUI in PyQt designer or other graphics tool, then upload a
> > screenshot of it to imgur, then post the link to the picture.
> Thanks, for your answer.
> But, what is "imgur"?
> I'm not so familiar with handling of pictures in this group.
> How can I call "imgur" or how can I get there?
>
> Regards
> Mohsen
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
https://mail.python.org/mailman/listinfo/python-list
Re: Free OCR package in Python and selecting appropriate widget for the GUI [ In reply to ]
On 9/21/2021 10:38 PM, Mohsen Owzar wrote:
> DFS schrieb am Dienstag, 21. September 2021 um 15:45:38 UTC+2:
>> On 9/21/2021 4:36 AM, Mohsen Owzar wrote:
>>> Hi Guys
>>> Long time ago I've written a program in Malab a GUI for solving Sudoku puzzles, which worked not so bad.
>>> Now I try to write this GUI with Python with PyQt5 or TKinter.
>>> First question is:
>>> Is there any free OCR software, packages or code in Python, which I can use to recognize the given digits and their positions in the puzzle square.
>>> Second:
>>> Because, I can not attach a picture to this post, I try to describe my picture of my GUI.
>> Draw your GUI in PyQt designer or other graphics tool, then upload a
>> screenshot of it to imgur, then post the link to the picture.
> Thanks, for your answer.
> But, what is "imgur"?
> I'm not so familiar with handling of pictures in this group.
> How can I call "imgur" or how can I get there?
>
> Regards
> Mohsen


www.imgur.com

It's a website you can upload image files or screenshots to. Then you
can copy a link to your picture and post the link here.


--
https://mail.python.org/mailman/listinfo/python-list
Re: Free OCR package in Python and selecting appropriate widget for the GUI [ In reply to ]
DFS schrieb am Mittwoch, 22. September 2021 um 05:10:30 UTC+2:
> On 9/21/2021 10:38 PM, Mohsen Owzar wrote:
> > DFS schrieb am Dienstag, 21. September 2021 um 15:45:38 UTC+2:
> >> On 9/21/2021 4:36 AM, Mohsen Owzar wrote:
> >>> Hi Guys
> >>> Long time ago I've written a program in Malab a GUI for solving Sudoku puzzles, which worked not so bad.
> >>> Now I try to write this GUI with Python with PyQt5 or TKinter.
> >>> First question is:
> >>> Is there any free OCR software, packages or code in Python, which I can use to recognize the given digits and their positions in the puzzle square.
> >>> Second:
> >>> Because, I can not attach a picture to this post, I try to describe my picture of my GUI.
> >> Draw your GUI in PyQt designer or other graphics tool, then upload a
> >> screenshot of it to imgur, then post the link to the picture.
> > Thanks, for your answer.
> > But, what is "imgur"?
> > I'm not so familiar with handling of pictures in this group.
> > How can I call "imgur" or how can I get there?
> >
> > Regards
> > Mohsen
> www.imgur.com
>
> It's a website you can upload image files or screenshots to. Then you
> can copy a link to your picture and post the link here.
I have already posted the link, but I can not see it anywhere.
Now, I post it again:
https://imgur.com/a/Vh8P2TE
I hope that you can see my two images.
Regards
Mohsen
--
https://mail.python.org/mailman/listinfo/python-list
Re: Free OCR package in Python and selecting appropriate widget for the GUI [ In reply to ]
Hello,


ti 21. syysk. 2021 klo 16.53 Mohsen Owzar (mohsen.owzar@gmail.com)
kirjoitti:

> Hi Guys
> Long time ago I've written a program in Malab a GUI for solving Sudoku
> puzzles, which worked not so bad.
> Now I try to write this GUI with Python with PyQt5 or TKinter.
> First question is:
> Is there any free OCR software, packages or code in Python, which I can
> use to recognize the given digits and their positions in the puzzle square.
>

to my knowledge there is no Python package for OCR. Using a free OCR
package that has a command line interface one could integrate this into a
Python script that makes a call to this external OCR e.g. using Python
module subprocess.

BR,
Roland


> Second:
> Because, I can not attach a picture to this post, I try to describe my
> picture of my GUI.
> It is a 3x3 block / matrix (one third of the whole Sudoku 9x9 block).
> This block must be placed three times in row and columns.
> Each square of this 3x3 block has 3x3 digits from 1 to 9 at the
> initialization time. These digits are spread out in 3x3 equal distances.
> These are small fonts and black.
> The values given by the puzzle are red big fonts and not changeable
> The digits typed by the user are black big fonts and changeable
> If there is a big font from the Puzzle / User, these must be removed from
> the neighboring fields from the 3x3 matrix (1-9).
> Now my question is, actually a hint from your side:
> What should I take as widget for one of these small squares to have
> different content as I described above?
> I thought of a QLineEdit in PyQt5 or LineEdit in TKinter, because the user
> must type some values in there and therefore can not be labels. So again,
> for the sake of the clarity.
> • When the fields are empty, each square has to show digits from 1
> to 9 with small fonts in 3x3 matrix order.
> • Given values in the puzzle are big fonts and red.
> • Digits which are typed by the user are big fonts and black.
> Now the question is, can I take only one LineEdit for all these tree
> situations, or I have to implement 9 small squares for small fonts and a
> big one for the big fonts?
> Any help and suggestion is welcome and appreciated.
>
> Best regards
> Mohsen
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
https://mail.python.org/mailman/listinfo/python-list
Re: Free OCR package in Python and selecting appropriate widget for the GUI [ In reply to ]
On 9/22/2021 1:54 AM, Mohsen Owzar wrote:
> DFS schrieb am Mittwoch, 22. September 2021 um 05:10:30 UTC+2:
>> On 9/21/2021 10:38 PM, Mohsen Owzar wrote:
>>> DFS schrieb am Dienstag, 21. September 2021 um 15:45:38 UTC+2:
>>>> On 9/21/2021 4:36 AM, Mohsen Owzar wrote:
>>>>> Hi Guys
>>>>> Long time ago I've written a program in Malab a GUI for solving Sudoku puzzles, which worked not so bad.
>>>>> Now I try to write this GUI with Python with PyQt5 or TKinter.
>>>>> First question is:
>>>>> Is there any free OCR software, packages or code in Python, which I can use to recognize the given digits and their positions in the puzzle square.
>>>>> Second:
>>>>> Because, I can not attach a picture to this post, I try to describe my picture of my GUI.
>>>> Draw your GUI in PyQt designer or other graphics tool, then upload a
>>>> screenshot of it to imgur, then post the link to the picture.
>>> Thanks, for your answer.
>>> But, what is "imgur"?
>>> I'm not so familiar with handling of pictures in this group.
>>> How can I call "imgur" or how can I get there?
>>>
>>> Regards
>>> Mohsen
>> www.imgur.com
>>
>> It's a website you can upload image files or screenshots to. Then you
>> can copy a link to your picture and post the link here.
> I have already posted the link, but I can not see it anywhere.
> Now, I post it again:
> https://imgur.com/a/Vh8P2TE
> I hope that you can see my two images.
> Regards
> Mohsen


Got it.

I haven't used tkinter. In PyQt5 designer I think you should use one
QTextEdit control for each square.


Each square with the small black font can be initially populated with

1 2 3
4 5 6
7 8 9



https://imgur.com/lTcEiML



some starter python code (maybe save as sudoku.py)

=====================================================================
from PyQt5 import Qt, QtCore, QtGui, QtWidgets, uic
from PyQt5.Qt import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

#objects
app = QtWidgets.QApplication([])
frm = uic.loadUi("sudoku.ui")


#grid = a collection of squares
grids = 1

#squares = number of squares per grid
squares = 9

#fill the squares with 1-9
def populateSquares():
for i in range(grids,grids+1):
for j in range(1,squares+1):
widget = frm.findChild(QtWidgets.QTextEdit, "txt{}_{}".format(i,j))
widget.setText("1 2 3 4 5 6 7 8 9")

#read data from squares
def readSquares():
for i in range(grids,grids+1):
for j in range(1,squares+1):
print("txt%d_%d contains: %s" %
(i,j,frm.findChild(QtWidgets.QTextEdit,
"txt{}_{}".format(i,j)).toPlainText()))


#connect pushbuttons to code
frm.btnPopulate.clicked.connect(populateSquares)
frm.btnReadContents.clicked.connect(readSquares)

#show main form
frm.show()

#initiate application
app.exec()
=====================================================================





.ui file (ie save as sudoku.ui)
=====================================================================

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>325</width>
<height>288</height>
</rect>
</property>
<property name="windowTitle">
<string>Sudoku</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QTextEdit" name="txt1_1">
<property name="geometry">
<rect>
<x>32</x>
<y>22</y>
<width>83</width>
<height>65</height>
</rect>
</property>
<property name="font">
<font>
<family>Courier</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 127);
background-color: rgb(255, 255, 127);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
</widget>
<widget class="QTextEdit" name="txt1_2">
<property name="geometry">
<rect>
<x>114</x>
<y>22</y>
<width>83</width>
<height>65</height>
</rect>
</property>
<property name="font">
<font>
<family>Courier</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 127);
background-color: rgb(255, 255, 127);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
</widget>
<widget class="QTextEdit" name="txt1_3">
<property name="geometry">
<rect>
<x>196</x>
<y>22</y>
<width>83</width>
<height>65</height>
</rect>
</property>
<property name="font">
<font>
<family>Courier</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 127);
background-color: rgb(255, 255, 127);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
</widget>
<widget class="QTextEdit" name="txt1_4">
<property name="geometry">
<rect>
<x>32</x>
<y>86</y>
<width>83</width>
<height>65</height>
</rect>
</property>
<property name="font">
<font>
<family>Courier</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 127);
background-color: rgb(255, 255, 127);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
</widget>
<widget class="QTextEdit" name="txt1_5">
<property name="geometry">
<rect>
<x>114</x>
<y>86</y>
<width>83</width>
<height>65</height>
</rect>
</property>
<property name="font">
<font>
<family>Courier</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 127);
background-color: rgb(255, 255, 127);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
</widget>
<widget class="QTextEdit" name="txt1_6">
<property name="geometry">
<rect>
<x>196</x>
<y>86</y>
<width>83</width>
<height>65</height>
</rect>
</property>
<property name="font">
<font>
<family>Courier</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 127);
background-color: rgb(255, 255, 127);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
</widget>
<widget class="QTextEdit" name="txt1_7">
<property name="geometry">
<rect>
<x>32</x>
<y>150</y>
<width>83</width>
<height>65</height>
</rect>
</property>
<property name="font">
<font>
<family>Courier</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 127);
background-color: rgb(255, 255, 127);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
</widget>
<widget class="QTextEdit" name="txt1_8">
<property name="geometry">
<rect>
<x>114</x>
<y>150</y>
<width>83</width>
<height>65</height>
</rect>
</property>
<property name="font">
<font>
<family>Courier</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 127);
background-color: rgb(255, 255, 127);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="btnPopulate">
<property name="geometry">
<rect>
<x>32</x>
<y>228</y>
<width>121</width>
<height>35</height>
</rect>
</property>
<property name="text">
<string>Populate with numbers</string>
</property>
</widget>
<widget class="QTextEdit" name="txt1_9">
<property name="geometry">
<rect>
<x>196</x>
<y>150</y>
<width>83</width>
<height>65</height>
</rect>
</property>
<property name="font">
<font>
<family>Courier</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 0, 127);
background-color: rgb(255, 255, 127);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="btnReadContents">
<property name="geometry">
<rect>
<x>170</x>
<y>228</y>
<width>109</width>
<height>35</height>
</rect>
</property>
<property name="text">
<string>Read contents</string>
</property>
</widget>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

=====================================================================







--
https://mail.python.org/mailman/listinfo/python-list
Re: Free OCR package in Python and selecting appropriate widget for the GUI [ In reply to ]
DFS schrieb am Mittwoch, 22. September 2021 um 09:41:42 UTC+2:
> On 9/22/2021 1:54 AM, Mohsen Owzar wrote:
> > DFS schrieb am Mittwoch, 22. September 2021 um 05:10:30 UTC+2:
> >> On 9/21/2021 10:38 PM, Mohsen Owzar wrote:
> >>> DFS schrieb am Dienstag, 21. September 2021 um 15:45:38 UTC+2:
> >>>> On 9/21/2021 4:36 AM, Mohsen Owzar wrote:
> >>>>> Hi Guys
> >>>>> Long time ago I've written a program in Malab a GUI for solving Sudoku puzzles, which worked not so bad.
> >>>>> Now I try to write this GUI with Python with PyQt5 or TKinter.
> >>>>> First question is:
> >>>>> Is there any free OCR software, packages or code in Python, which I can use to recognize the given digits and their positions in the puzzle square.
> >>>>> Second:
> >>>>> Because, I can not attach a picture to this post, I try to describe my picture of my GUI.
> >>>> Draw your GUI in PyQt designer or other graphics tool, then upload a
> >>>> screenshot of it to imgur, then post the link to the picture.
> >>> Thanks, for your answer.
> >>> But, what is "imgur"?
> >>> I'm not so familiar with handling of pictures in this group.
> >>> How can I call "imgur" or how can I get there?
> >>>
> >>> Regards
> >>> Mohsen
> >> www.imgur.com
> >>
> >> It's a website you can upload image files or screenshots to. Then you
> >> can copy a link to your picture and post the link here.
> > I have already posted the link, but I can not see it anywhere.
> > Now, I post it again:
> > https://imgur.com/a/Vh8P2TE
> > I hope that you can see my two images.
> > Regards
> > Mohsen
> Got it.
>
> I haven't used tkinter. In PyQt5 designer I think you should use one
> QTextEdit control for each square.
>
>
> Each square with the small black font can be initially populated with
>
> 1 2 3
> 4 5 6
> 7 8 9
>
>
>
> https://imgur.com/lTcEiML
>
>
>
> some starter python code (maybe save as sudoku.py)
>
> =====================================================================
> from PyQt5 import Qt, QtCore, QtGui, QtWidgets, uic
> from PyQt5.Qt import *
> from PyQt5.QtCore import *
> from PyQt5.QtGui import *
> from PyQt5.QtWidgets import *
>
> #objects
> app = QtWidgets.QApplication([])
> frm = uic.loadUi("sudoku.ui")
>
>
> #grid = a collection of squares
> grids = 1
>
> #squares = number of squares per grid
> squares = 9
>
> #fill the squares with 1-9
> def populateSquares():
> for i in range(grids,grids+1):
> for j in range(1,squares+1):
> widget = frm.findChild(QtWidgets.QTextEdit, "txt{}_{}".format(i,j))
> widget.setText("1 2 3 4 5 6 7 8 9")
>
> #read data from squares
> def readSquares():
> for i in range(grids,grids+1):
> for j in range(1,squares+1):
> print("txt%d_%d contains: %s" %
> (i,j,frm.findChild(QtWidgets.QTextEdit,
> "txt{}_{}".format(i,j)).toPlainText()))
>
>
> #connect pushbuttons to code
> frm.btnPopulate.clicked.connect(populateSquares)
> frm.btnReadContents.clicked.connect(readSquares)
>
> #show main form
> frm.show()
>
> #initiate application
> app.exec()
> =====================================================================
>
>
>
>
>
> .ui file (ie save as sudoku.ui)
> =====================================================================
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ui version="4.0">
> <class>MainWindow</class>
> <widget class="QMainWindow" name="MainWindow">
> <property name="geometry">
> <rect>
> <x>0</x>
> <y>0</y>
> <width>325</width>
> <height>288</height>
> </rect>
> </property>
> <property name="windowTitle">
> <string>Sudoku</string>
> </property>
> <widget class="QWidget" name="centralwidget">
> <widget class="QTextEdit" name="txt1_1">
> <property name="geometry">
> <rect>
> <x>32</x>
> <y>22</y>
> <width>83</width>
> <height>65</height>
> </rect>
> </property>
> <property name="font">
> <font>
> <family>Courier</family>
> <pointsize>12</pointsize>
> <weight>50</weight>
> <bold>false</bold>
> </font>
> </property>
> <property name="acceptDrops">
> <bool>false</bool>
> </property>
> <property name="styleSheet">
> <string notr="true">color: rgb(0, 0, 127);
> background-color: rgb(255, 255, 127);</string>
> </property>
> <property name="frameShape">
> <enum>QFrame::StyledPanel</enum>
> </property>
> <property name="frameShadow">
> <enum>QFrame::Sunken</enum>
> </property>
> <property name="horizontalScrollBarPolicy">
> <enum>Qt::ScrollBarAlwaysOff</enum>
> </property>
> <property name="acceptRichText">
> <bool>true</bool>
> </property>
> </widget>
> <widget class="QTextEdit" name="txt1_2">
> <property name="geometry">
> <rect>
> <x>114</x>
> <y>22</y>
> <width>83</width>
> <height>65</height>
> </rect>
> </property>
> <property name="font">
> <font>
> <family>Courier</family>
> <pointsize>12</pointsize>
> <weight>50</weight>
> <bold>false</bold>
> </font>
> </property>
> <property name="acceptDrops">
> <bool>false</bool>
> </property>
> <property name="styleSheet">
> <string notr="true">color: rgb(0, 0, 127);
> background-color: rgb(255, 255, 127);</string>
> </property>
> <property name="frameShape">
> <enum>QFrame::StyledPanel</enum>
> </property>
> <property name="frameShadow">
> <enum>QFrame::Sunken</enum>
> </property>
> <property name="horizontalScrollBarPolicy">
> <enum>Qt::ScrollBarAlwaysOff</enum>
> </property>
> <property name="acceptRichText">
> <bool>true</bool>
> </property>
> </widget>
> <widget class="QTextEdit" name="txt1_3">
> <property name="geometry">
> <rect>
> <x>196</x>
> <y>22</y>
> <width>83</width>
> <height>65</height>
> </rect>
> </property>
> <property name="font">
> <font>
> <family>Courier</family>
> <pointsize>12</pointsize>
> <weight>50</weight>
> <bold>false</bold>
> </font>
> </property>
> <property name="acceptDrops">
> <bool>false</bool>
> </property>
> <property name="styleSheet">
> <string notr="true">color: rgb(0, 0, 127);
> background-color: rgb(255, 255, 127);</string>
> </property>
> <property name="frameShape">
> <enum>QFrame::StyledPanel</enum>
> </property>
> <property name="frameShadow">
> <enum>QFrame::Sunken</enum>
> </property>
> <property name="horizontalScrollBarPolicy">
> <enum>Qt::ScrollBarAlwaysOff</enum>
> </property>
> <property name="acceptRichText">
> <bool>true</bool>
> </property>
> </widget>
> <widget class="QTextEdit" name="txt1_4">
> <property name="geometry">
> <rect>
> <x>32</x>
> <y>86</y>
> <width>83</width>
> <height>65</height>
> </rect>
> </property>
> <property name="font">
> <font>
> <family>Courier</family>
> <pointsize>12</pointsize>
> <weight>50</weight>
> <bold>false</bold>
> </font>
> </property>
> <property name="acceptDrops">
> <bool>false</bool>
> </property>
> <property name="styleSheet">
> <string notr="true">color: rgb(0, 0, 127);
> background-color: rgb(255, 255, 127);</string>
> </property>
> <property name="frameShape">
> <enum>QFrame::StyledPanel</enum>
> </property>
> <property name="frameShadow">
> <enum>QFrame::Sunken</enum>
> </property>
> <property name="horizontalScrollBarPolicy">
> <enum>Qt::ScrollBarAlwaysOff</enum>
> </property>
> <property name="acceptRichText">
> <bool>true</bool>
> </property>
> </widget>
> <widget class="QTextEdit" name="txt1_5">
> <property name="geometry">
> <rect>
> <x>114</x>
> <y>86</y>
> <width>83</width>
> <height>65</height>
> </rect>
> </property>
> <property name="font">
> <font>
> <family>Courier</family>
> <pointsize>12</pointsize>
> <weight>50</weight>
> <bold>false</bold>
> </font>
> </property>
> <property name="acceptDrops">
> <bool>false</bool>
> </property>
> <property name="styleSheet">
> <string notr="true">color: rgb(0, 0, 127);
> background-color: rgb(255, 255, 127);</string>
> </property>
> <property name="frameShape">
> <enum>QFrame::StyledPanel</enum>
> </property>
> <property name="frameShadow">
> <enum>QFrame::Sunken</enum>
> </property>
> <property name="horizontalScrollBarPolicy">
> <enum>Qt::ScrollBarAlwaysOff</enum>
> </property>
> <property name="acceptRichText">
> <bool>true</bool>
> </property>
> </widget>
> <widget class="QTextEdit" name="txt1_6">
> <property name="geometry">
> <rect>
> <x>196</x>
> <y>86</y>
> <width>83</width>
> <height>65</height>
> </rect>
> </property>
> <property name="font">
> <font>
> <family>Courier</family>
> <pointsize>12</pointsize>
> <weight>50</weight>
> <bold>false</bold>
> </font>
> </property>
> <property name="acceptDrops">
> <bool>false</bool>
> </property>
> <property name="styleSheet">
> <string notr="true">color: rgb(0, 0, 127);
> background-color: rgb(255, 255, 127);</string>
> </property>
> <property name="frameShape">
> <enum>QFrame::StyledPanel</enum>
> </property>
> <property name="frameShadow">
> <enum>QFrame::Sunken</enum>
> </property>
> <property name="horizontalScrollBarPolicy">
> <enum>Qt::ScrollBarAlwaysOff</enum>
> </property>
> <property name="acceptRichText">
> <bool>true</bool>
> </property>
> </widget>
> <widget class="QTextEdit" name="txt1_7">
> <property name="geometry">
> <rect>
> <x>32</x>
> <y>150</y>
> <width>83</width>
> <height>65</height>
> </rect>
> </property>
> <property name="font">
> <font>
> <family>Courier</family>
> <pointsize>12</pointsize>
> <weight>50</weight>
> <bold>false</bold>
> </font>
> </property>
> <property name="acceptDrops">
> <bool>false</bool>
> </property>
> <property name="styleSheet">
> <string notr="true">color: rgb(0, 0, 127);
> background-color: rgb(255, 255, 127);</string>
> </property>
> <property name="frameShape">
> <enum>QFrame::StyledPanel</enum>
> </property>
> <property name="frameShadow">
> <enum>QFrame::Sunken</enum>
> </property>
> <property name="horizontalScrollBarPolicy">
> <enum>Qt::ScrollBarAlwaysOff</enum>
> </property>
> <property name="acceptRichText">
> <bool>true</bool>
> </property>
> </widget>
> <widget class="QTextEdit" name="txt1_8">
> <property name="geometry">
> <rect>
> <x>114</x>
> <y>150</y>
> <width>83</width>
> <height>65</height>
> </rect>
> </property>
> <property name="font">
> <font>
> <family>Courier</family>
> <pointsize>12</pointsize>
> <weight>50</weight>
> <bold>false</bold>
> </font>
> </property>
> <property name="acceptDrops">
> <bool>false</bool>
> </property>
> <property name="styleSheet">
> <string notr="true">color: rgb(0, 0, 127);
> background-color: rgb(255, 255, 127);</string>
> </property>
> <property name="frameShape">
> <enum>QFrame::StyledPanel</enum>
> </property>
> <property name="frameShadow">
> <enum>QFrame::Sunken</enum>
> </property>
> <property name="horizontalScrollBarPolicy">
> <enum>Qt::ScrollBarAlwaysOff</enum>
> </property>
> <property name="acceptRichText">
> <bool>true</bool>
> </property>
> </widget>
> <widget class="QPushButton" name="btnPopulate">
> <property name="geometry">
> <rect>
> <x>32</x>
> <y>228</y>
> <width>121</width>
> <height>35</height>
> </rect>
> </property>
> <property name="text">
> <string>Populate with numbers</string>
> </property>
> </widget>
> <widget class="QTextEdit" name="txt1_9">
> <property name="geometry">
> <rect>
> <x>196</x>
> <y>150</y>
> <width>83</width>
> <height>65</height>
> </rect>
> </property>
> <property name="font">
> <font>
> <family>Courier</family>
> <pointsize>12</pointsize>
> <weight>50</weight>
> <bold>false</bold>
> </font>
> </property>
> <property name="acceptDrops">
> <bool>false</bool>
> </property>
> <property name="styleSheet">
> <string notr="true">color: rgb(0, 0, 127);
> background-color: rgb(255, 255, 127);</string>
> </property>
> <property name="frameShape">
> <enum>QFrame::StyledPanel</enum>
> </property>
> <property name="frameShadow">
> <enum>QFrame::Sunken</enum>
> </property>
> <property name="horizontalScrollBarPolicy">
> <enum>Qt::ScrollBarAlwaysOff</enum>
> </property>
> <property name="acceptRichText">
> <bool>true</bool>
> </property>
> </widget>
> <widget class="QPushButton" name="btnReadContents">
> <property name="geometry">
> <rect>
> <x>170</x>
> <y>228</y>
> <width>109</width>
> <height>35</height>
> </rect>
> </property>
> <property name="text">
> <string>Read contents</string>
> </property>
> </widget>
> </widget>
> <widget class="QStatusBar" name="statusbar"/>
> </widget>
> <resources/>
> <connections/>
> </ui>
>
> =====================================================================
Thank you,

I'll try to use this QTextEdit, to see if I'm able to manage my needs.

Regards
Mohsen
--
https://mail.python.org/mailman/listinfo/python-list
Re: Free OCR package in Python and selecting appropriate widget for the GUI [ In reply to ]
Mohsen Owzar schrieb am Donnerstag, 23. September 2021 um 08:53:15 UTC+2:
> DFS schrieb am Mittwoch, 22. September 2021 um 09:41:42 UTC+2:
> > On 9/22/2021 1:54 AM, Mohsen Owzar wrote:
> > > DFS schrieb am Mittwoch, 22. September 2021 um 05:10:30 UTC+2:
> > >> On 9/21/2021 10:38 PM, Mohsen Owzar wrote:
> > >>> DFS schrieb am Dienstag, 21. September 2021 um 15:45:38 UTC+2:
> > >>>> On 9/21/2021 4:36 AM, Mohsen Owzar wrote:
> > >>>>> Hi Guys
> > >>>>> Long time ago I've written a program in Malab a GUI for solving Sudoku puzzles, which worked not so bad.
> > >>>>> Now I try to write this GUI with Python with PyQt5 or TKinter.
> > >>>>> First question is:
> > >>>>> Is there any free OCR software, packages or code in Python, which I can use to recognize the given digits and their positions in the puzzle square.
> > >>>>> Second:
> > >>>>> Because, I can not attach a picture to this post, I try to describe my picture of my GUI.
> > >>>> Draw your GUI in PyQt designer or other graphics tool, then upload a
> > >>>> screenshot of it to imgur, then post the link to the picture.
> > >>> Thanks, for your answer. Hi
> > >>> But, what is "imgur"?
> > >>> I'm not so familiar with handling of pictures in this group.
> > >>> How can I call "imgur" or how can I get there?
> > >>>
> > >>> Regards
> > >>> Mohsen
> > >> www.imgur.com
> > >>
> > >> It's a website you can upload image files or screenshots to. Then you
> > >> can copy a link to your picture and post the link here.
> > > I have already posted the link, but I can not see it anywhere.
> > > Now, I post it again:
> > > https://imgur.com/a/Vh8P2TE
> > > I hope that you can see my two images.
> > > Regards
> > > Mohsen
> > Got it.
> >
> > I haven't used tkinter. In PyQt5 designer I think you should use one
> > QTextEdit control for each square.
> >
> >
> > Each square with the small black font can be initially populated with
> >
> > 1 2 3
> > 4 5 6
> > 7 8 9
> >
> >
> >
> > https://imgur.com/lTcEiML
> >
> >
> >
> > some starter python code (maybe save as sudoku.py)
> >
> > =====================================================================
> > from PyQt5 import Qt, QtCore, QtGui, QtWidgets, uic
> > from PyQt5.Qt import *
> > from PyQt5.QtCore import *
> > from PyQt5.QtGui import *
> > from PyQt5.QtWidgets import *
> >
> > #objects
> > app = QtWidgets.QApplication([])
> > frm = uic.loadUi("sudoku.ui")
> >
> >
> > #grid = a collection of squares
> > grids = 1
> >
> > #squares = number of squares per grid
> > squares = 9
> >
> > #fill the squares with 1-9
> > def populateSquares():
> > for i in range(grids,grids+1):
> > for j in range(1,squares+1):
> > widget = frm.findChild(QtWidgets.QTextEdit, "txt{}_{}".format(i,j))
> > widget.setText("1 2 3 4 5 6 7 8 9")
> >
> > #read data from squares
> > def readSquares():
> > for i in range(grids,grids+1):
> > for j in range(1,squares+1):
> > print("txt%d_%d contains: %s" %
> > (i,j,frm.findChild(QtWidgets.QTextEdit,
> > "txt{}_{}".format(i,j)).toPlainText()))
> >
> >
> > #connect pushbuttons to code
> > frm.btnPopulate.clicked.connect(populateSquares)
> > frm.btnReadContents.clicked.connect(readSquares)
> >
> > #show main form
> > frm.show()
> >
> > #initiate application
> > app.exec()
> > =====================================================================
> >
> >
> >
> >
> >
> > .ui file (ie save as sudoku.ui)
> > =====================================================================
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <ui version="4.0">
> > <class>MainWindow</class>
> > <widget class="QMainWindow" name="MainWindow">
> > <property name="geometry">
> > <rect>
> > <x>0</x>
> > <y>0</y>
> > <width>325</width>
> > <height>288</height>
> > </rect>
> > </property>
> > <property name="windowTitle">
> > <string>Sudoku</string>
> > </property>
> > <widget class="QWidget" name="centralwidget">
> > <widget class="QTextEdit" name="txt1_1">
> > <property name="geometry">
> > <rect>
> > <x>32</x>
> > <y>22</y>
> > <width>83</width>
> > <height>65</height>
> > </rect>
> > </property>
> > <property name="font">
> > <font>
> > <family>Courier</family>
> > <pointsize>12</pointsize>
> > <weight>50</weight>
> > <bold>false</bold>
> > </font>
> > </property>
> > <property name="acceptDrops">
> > <bool>false</bool>
> > </property>
> > <property name="styleSheet">
> > <string notr="true">color: rgb(0, 0, 127);
> > background-color: rgb(255, 255, 127);</string>
> > </property>
> > <property name="frameShape">
> > <enum>QFrame::StyledPanel</enum>
> > </property>
> > <property name="frameShadow">
> > <enum>QFrame::Sunken</enum>
> > </property>
> > <property name="horizontalScrollBarPolicy">
> > <enum>Qt::ScrollBarAlwaysOff</enum>
> > </property>
> > <property name="acceptRichText">
> > <bool>true</bool>
> > </property>
> > </widget>
> > <widget class="QTextEdit" name="txt1_2">
> > <property name="geometry">
> > <rect>
> > <x>114</x>
> > <y>22</y>
> > <width>83</width>
> > <height>65</height>
> > </rect>
> > </property>
> > <property name="font">
> > <font>
> > <family>Courier</family>
> > <pointsize>12</pointsize>
> > <weight>50</weight>
> > <bold>false</bold>
> > </font>
> > </property>
> > <property name="acceptDrops">
> > <bool>false</bool>
> > </property>
> > <property name="styleSheet">
> > <string notr="true">color: rgb(0, 0, 127);
> > background-color: rgb(255, 255, 127);</string>
> > </property>
> > <property name="frameShape">
> > <enum>QFrame::StyledPanel</enum>
> > </property>
> > <property name="frameShadow">
> > <enum>QFrame::Sunken</enum>
> > </property>
> > <property name="horizontalScrollBarPolicy">
> > <enum>Qt::ScrollBarAlwaysOff</enum>
> > </property>
> > <property name="acceptRichText">
> > <bool>true</bool>
> > </property>
> > </widget>
> > <widget class="QTextEdit" name="txt1_3">
> > <property name="geometry">
> > <rect>
> > <x>196</x>
> > <y>22</y>
> > <width>83</width>
> > <height>65</height>
> > </rect>
> > </property>
> > <property name="font">
> > <font>
> > <family>Courier</family>
> > <pointsize>12</pointsize>
> > <weight>50</weight>
> > <bold>false</bold>
> > </font>
> > </property>
> > <property name="acceptDrops">
> > <bool>false</bool>
> > </property>
> > <property name="styleSheet">
> > <string notr="true">color: rgb(0, 0, 127);
> > background-color: rgb(255, 255, 127);</string>
> > </property>
> > <property name="frameShape">
> > <enum>QFrame::StyledPanel</enum>
> > </property>
> > <property name="frameShadow">
> > <enum>QFrame::Sunken</enum>
> > </property>
> > <property name="horizontalScrollBarPolicy">
> > <enum>Qt::ScrollBarAlwaysOff</enum>
> > </property>
> > <property name="acceptRichText">
> > <bool>true</bool>
> > </property>
> > </widget>
> > <widget class="QTextEdit" name="txt1_4">
> > <property name="geometry">
> > <rect>
> > <x>32</x>
> > <y>86</y>
> > <width>83</width>
> > <height>65</height>
> > </rect>
> > </property>
> > <property name="font">
> > <font>
> > <family>Courier</family>
> > <pointsize>12</pointsize>
> > <weight>50</weight>
> > <bold>false</bold>
> > </font>
> > </property>
> > <property name="acceptDrops">
> > <bool>false</bool>
> > </property>
> > <property name="styleSheet">
> > <string notr="true">color: rgb(0, 0, 127);
> > background-color: rgb(255, 255, 127);</string>
> > </property>
> > <property name="frameShape">
> > <enum>QFrame::StyledPanel</enum>
> > </property>
> > <property name="frameShadow">
> > <enum>QFrame::Sunken</enum>
> > </property>
> > <property name="horizontalScrollBarPolicy">
> > <enum>Qt::ScrollBarAlwaysOff</enum>
> > </property>
> > <property name="acceptRichText">
> > <bool>true</bool>
> > </property>
> > </widget>
> > <widget class="QTextEdit" name="txt1_5">
> > <property name="geometry">
> > <rect>
> > <x>114</x>
> > <y>86</y>
> > <width>83</width>
> > <height>65</height>
> > </rect>
> > </property>
> > <property name="font">
> > <font>
> > <family>Courier</family>
> > <pointsize>12</pointsize>
> > <weight>50</weight>
> > <bold>false</bold>
> > </font>
> > </property>
> > <property name="acceptDrops">
> > <bool>false</bool>
> > </property>
> > <property name="styleSheet">
> > <string notr="true">color: rgb(0, 0, 127);
> > background-color: rgb(255, 255, 127);</string>
> > </property>
> > <property name="frameShape">
> > <enum>QFrame::StyledPanel</enum>
> > </property>
> > <property name="frameShadow">
> > <enum>QFrame::Sunken</enum>
> > </property>
> > <property name="horizontalScrollBarPolicy">
> > <enum>Qt::ScrollBarAlwaysOff</enum>
> > </property>
> > <property name="acceptRichText">
> > <bool>true</bool>
> > </property>
> > </widget>
> > <widget class="QTextEdit" name="txt1_6">
> > <property name="geometry">
> > <rect>
> > <x>196</x>
> > <y>86</y>
> > <width>83</width>
> > <height>65</height>
> > </rect>
> > </property>
> > <property name="font">
> > <font>
> > <family>Courier</family>
> > <pointsize>12</pointsize>
> > <weight>50</weight>
> > <bold>false</bold>
> > </font>
> > </property>
> > <property name="acceptDrops">
> > <bool>false</bool>
> > </property>
> > <property name="styleSheet">
> > <string notr="true">color: rgb(0, 0, 127);
> > background-color: rgb(255, 255, 127);</string>
> > </property>
> > <property name="frameShape">
> > <enum>QFrame::StyledPanel</enum>
> > </property>
> > <property name="frameShadow">
> > <enum>QFrame::Sunken</enum>
> > </property>
> > <property name="horizontalScrollBarPolicy">
> > <enum>Qt::ScrollBarAlwaysOff</enum>
> > </property>
> > <property name="acceptRichText">
> > <bool>true</bool>
> > </property>
> > </widget>
> > <widget class="QTextEdit" name="txt1_7">
> > <property name="geometry">
> > <rect>
> > <x>32</x>
> > <y>150</y>
> > <width>83</width>
> > <height>65</height>
> > </rect>
> > </property>
> > <property name="font">
> > <font>
> > <family>Courier</family>
> > <pointsize>12</pointsize>
> > <weight>50</weight>
> > <bold>false</bold>
> > </font>
> > </property>
> > <property name="acceptDrops">
> > <bool>false</bool>
> > </property>
> > <property name="styleSheet">
> > <string notr="true">color: rgb(0, 0, 127);
> > background-color: rgb(255, 255, 127);</string>
> > </property>
> > <property name="frameShape">
> > <enum>QFrame::StyledPanel</enum>
> > </property>
> > <property name="frameShadow">
> > <enum>QFrame::Sunken</enum>
> > </property>
> > <property name="horizontalScrollBarPolicy">
> > <enum>Qt::ScrollBarAlwaysOff</enum>
> > </property>
> > <property name="acceptRichText">
> > <bool>true</bool>
> > </property>
> > </widget>
> > <widget class="QTextEdit" name="txt1_8">
> > <property name="geometry">
> > <rect>
> > <x>114</x>
> > <y>150</y>
> > <width>83</width>
> > <height>65</height>
> > </rect>
> > </property>
> > <property name="font">
> > <font>
> > <family>Courier</family>
> > <pointsize>12</pointsize>
> > <weight>50</weight>
> > <bold>false</bold>
> > </font>
> > </property>
> > <property name="acceptDrops">
> > <bool>false</bool>
> > </property>
> > <property name="styleSheet">
> > <string notr="true">color: rgb(0, 0, 127);
> > background-color: rgb(255, 255, 127);</string>
> > </property>
> > <property name="frameShape">
> > <enum>QFrame::StyledPanel</enum>
> > </property>
> > <property name="frameShadow">
> > <enum>QFrame::Sunken</enum>
> > </property>
> > <property name="horizontalScrollBarPolicy">
> > <enum>Qt::ScrollBarAlwaysOff</enum>
> > </property>
> > <property name="acceptRichText">
> > <bool>true</bool>
> > </property>
> > </widget>
> > <widget class="QPushButton" name="btnPopulate">
> > <property name="geometry">
> > <rect>
> > <x>32</x>
> > <y>228</y>
> > <width>121</width>
> > <height>35</height>
> > </rect>
> > </property>
> > <property name="text">
> > <string>Populate with numbers</string>
> > </property>
> > </widget>
> > <widget class="QTextEdit" name="txt1_9">
> > <property name="geometry">
> > <rect>
> > <x>196</x>
> > <y>150</y>
> > <width>83</width>
> > <height>65</height>
> > </rect>
> > </property>
> > <property name="font">
> > <font>
> > <family>Courier</family>
> > <pointsize>12</pointsize>
> > <weight>50</weight>
> > <bold>false</bold>
> > </font>
> > </property>
> > <property name="acceptDrops">
> > <bool>false</bool>
> > </property>
> > <property name="styleSheet">
> > <string notr="true">color: rgb(0, 0, 127);
> > background-color: rgb(255, 255, 127);</string>
> > </property>
> > <property name="frameShape">
> > <enum>QFrame::StyledPanel</enum>
> > </property>
> > <property name="frameShadow">
> > <enum>QFrame::Sunken</enum>
> > </property>
> > <property name="horizontalScrollBarPolicy">
> > <enum>Qt::ScrollBarAlwaysOff</enum>
> > </property>
> > <property name="acceptRichText">
> > <bool>true</bool>
> > </property>
> > </widget>
> > <widget class="QPushButton" name="btnReadContents">
> > <property name="geometry">
> > <rect>
> > <x>170</x>
> > <y>228</y>
> > <width>109</width>
> > <height>35</height>
> > </rect>
> > </property>
> > <property name="text">
> > <string>Read contents</string>
> > </property>
> > </widget>
> > </widget>
> > <widget class="QStatusBar" name="statusbar"/>
> > </widget>
> > <resources/>
> > <connections/>
> > </ui>
> >
> > =====================================================================
> Thank you,
>
> I'll try to use this QTextEdit, to see if I'm able to manage my needs.
>
> Regards
> Mohsen

Hi DFS,
I’ve copied your code and ran it.
It is almost that what I wanted except the fact, the 9 digits are not behave as a 3x3 matrix.
When I click on the button “Populate with numbers”, on my screen looks like below in each square:
1 2 3 4
5 6 7 8
9
I want to get the numbers in a matrix form as:
1 2 3
4 5 6
7 8 9
And they should be placed centered in each square.
And when a digit is missing, let say 4, 5 doesn’t have to take its place , so that:
1 2 3
5 6
7 8 9
And when the real number / digit is found, it should be a big one digit in the center of the square.
I don’t know how to bring these two different font sizes and digit placements under one hat.
Do you have any idea?

Regards
Mohsen

--
https://mail.python.org/mailman/listinfo/python-list