Re: Tkinter: which ttk widget for database table primary key?

2020-03-18 Thread Rich Shepard

On Wed, 18 Mar 2020, MRAB wrote:


You can make the Entry widget read-only:
   entry_widget['state'] = 'readonly'
The user will still be able to copy from it.

Alternatively, you can disable it:

   entry_widget['state'] = 'disabled'

The user won't be able to copy from it.

When updating the GUI, you'll need to make it writeable if you have it 
currently read-only or disabled:


   entry_widget['state'] = 'normal'
   :
   # Change the contents here.
   :
   entry_widget['state'] = 'readonly'


MRAB,

Thanks very much for expanding on Christian's response. This is the widget
I'll use and set it to 'readonly'.

Regards,

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


Re: Tkinter: which ttk widget for database table primary key?

2020-03-18 Thread Rich Shepard

On Wed, 18 Mar 2020, Christian Gollwitzer wrote:


You can use an Entry and set it to readonly state. Or you can use a Label.
The advantage of the readonly Entry is, that the user can still copy/paste
the content, and that it can scroll if the string is very long.


Christian,

Thank you. I did not find all options for the Entry widget in my quick look
for them. I like this because users will sometimes want to find all data
from that location and being able to copy that number and paste it in a
query will be helpful.

Regards,

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


Re: Tkinter: which ttk widget for database table primary key?

2020-03-18 Thread MRAB

On 2020-03-18 20:39, Rich Shepard wrote:

Subject might be confusing so I'll expand it here.

My application uses a database backend in which each table has a unique and
database-generated sequential numeric key. I want to display that key in the
GUI for that class but it's not entered by the user or altered. It seems to
me that the ttk.Entry and ttk.Spinbox widgets are inappropriate. As a
newcomer to Tkinter I ask for advice on which widget to use.


You can make the Entry widget read-only:

entry_widget['state'] = 'readonly'

The user will still be able to copy from it.

Alternatively, you can disable it:

entry_widget['state'] = 'disabled'

The user won't be able to copy from it.

When updating the GUI, you'll need to make it writeable if you have it 
currently read-only or disabled:


entry_widget['state'] = 'normal'
:
# Change the contents here.
:
entry_widget['state'] = 'readonly'
--
https://mail.python.org/mailman/listinfo/python-list


Re: Tkinter: which ttk widget for database table primary key?

2020-03-18 Thread Christian Gollwitzer

Am 18.03.20 um 21:39 schrieb Rich Shepard:

Subject might be confusing so I'll expand it here.

My application uses a database backend in which each table has a unique and
database-generated sequential numeric key. I want to display that key in 
the

GUI for that class but it's not entered by the user or altered. It seems to
me that the ttk.Entry and ttk.Spinbox widgets are inappropriate. As a
newcomer to Tkinter I ask for advice on which widget to use.


You can use an Entry and set it to readonly state. Or you can use a 
Label. The advantage of the readonly Entry is, that the user can still 
copy/paste the content, and that it can scroll if the string is very long.


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


Tkinter: which ttk widget for database table primary key?

2020-03-18 Thread Rich Shepard

Subject might be confusing so I'll expand it here.

My application uses a database backend in which each table has a unique and
database-generated sequential numeric key. I want to display that key in the
GUI for that class but it's not entered by the user or altered. It seems to
me that the ttk.Entry and ttk.Spinbox widgets are inappropriate. As a
newcomer to Tkinter I ask for advice on which widget to use.

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