What is this TEST BANK stuff ?
Why do we tolerate this spam ? this seems most likely a way to inject viruses into people's workflow. That wiped out usenet. Ahh without an explaination; ( and it woudl have to be a good one ); what is the purpsoe of this, why is it here ? Can it be eliminated ? Regards, Dan -- https://mail.python.org/mailman/listinfo/python-list
TKinter in Python - advanced notions
Hi,
I've write a huge biotech program ( an IDE for synthetic biology ), and am
slowly outgrowing TKINTER.
Has anybody out there merged a little bit of TCL direct calls from Python 3.X
to get more freedom then TKINTER for just some Windows ?
How about bold stories of successes ( yours, not mine ) on porting to stupid MS
Windows from linux ?
Adding threading makes TKinter hard ( but not impossible ) to manage. Also, a
little bit here and there obviously exceeds TKINTERs goals.
I wish it looked better, but its 'ok'. I believe X11 IO is considerably
superior for serious work the HTML. I mean 'serious' work. with lots of multi
media windows. I am not talking about fb "Oh ! There is a window it opened
inthe corner !"... trivial functionality.
Must be a uber expert out there. Is it you ?
As attached. and little code. Coloring text makes me realise; some of this is
pretty indirect, though this is quite well thought out, like all of TKINTER.
Regards,
Daniel B. Kolis
"""
An important worked example of text color and other look dynamic changes.
This is the righ way to do this for fast changes !
20 Jun 2023 22:11
"""
import tkinter as tk
from tkinter.font import Font
class Pad( tk.Frame ):
def __init__( self, parent, *args, **kwargs ):
tk.Frame.__init__( self, parent, *args, **kwargs )
self.toolbar = tk.Frame( self, bg="#eee" )
self.toolbar.pack( side="top", fill="x" )
self.bold_btn = tk.Button( self.toolbar, text="CHANGE highlighted",
command=self.make_Change_Highlighted )
self.bold_btn.pack( side="left" )
self.bold_btn = tk.Button( self.toolbar, text="CHANGE H.B.",
command=self.make_Change_Hb )
self.bold_btn.pack( side="left" )
self.bold_btn = tk.Button( self.toolbar, text="Delete a char",
command=self.make_Change_Delete )
self.bold_btn.pack( side="left" )
self.clear_btn = tk.Button( self.toolbar, text="Clear",
command=self.clear_Some )
self.clear_btn.pack( side="left" )
# Applies this font
self.bold_font = Font( family="Helvetica", size=14, weight="bold" )
self.da_Text = tk.Text( self )
self.da_Text.insert( "end", "Selectable parts of text is fun.\nSo is a
happy birthday, right ?" )
self.da_Text.focus( )
self.da_Text.pack( fill="both", expand=True )
# configuring a tag called dingo-something
self.da_Text.tag_configure( "reddingo", font=self.bold_font,
foreground = "Red" )
self.da_Text.tag_configure( "bluedingo", font=self.bold_font,
background = "Yellow", foreground = "Blue" )
# Button CB
def make_Change_Delete( self ):
self.da_Text.delete( '1.0', '1.1' )
# Button CB
def make_Change_Highlighted( self ):
# tk.TclError exception is raised if not text is selected
try:
self.da_Text.tag_add( "reddingo", "sel.first", "sel.last" )
except tk.TclError:
tt = 569
# Button CB
def make_Change_Hb( self ):
try:
lin_Idx = 2; col_Idx = 8
self.da_Text.tag_add( "bluedingo", f"{ lin_Idx }.{ col_Idx }",
f"{ lin_Idx }.{ col_Idx + len(
'happy birthday' ) }" )
except:
gg = 457
# Button CB
def clear_Some( self ):
self.da_Text.tag_remove( "reddingo", "1.0", 'end' )
self.da_Text.tag_remove( "bluedingo", "1.0", 'end' )
# Main body really
def is_Main():
root = tk.Tk()
Pad( root ).pack( expand=1, fill="both" )
root.mainloop()
# Go
if __name__ == "__main__":
is_Main()
Document end
my ref: 21 Jun 2023, https://groups.google.com/g/comp.lang.python, Daniel B.
Kolis, nafl
--
https://mail.python.org/mailman/listinfo/python-list
Re: TKinter in Python - advanced notions
If you have a problem,. ask a super specific question, here. If I can help, I will, but TKINTER knowledge is pretty spread around. Many others migth jump in, too. Its works, its slightly quirky, has no licencing hangups. X11 makes fine fine programs ! Keep hacking,Dan -- https://mail.python.org/mailman/listinfo/python-list
Re: TKinter in Python - advanced notions - reactive
I am not specifically having any problems implementing what I want to make work. Callbacks etc make it fairly easy to make TKinter react to things without any specific fancy plan for it. Add callbacks for real time changes early in any new notion, after it looks right go to the IO part make it react. Regards, thanks, Dan -- https://mail.python.org/mailman/listinfo/python-list
TKinter in Python - advanced notions - ok
Well, its kind of obvious to make a skeleton, copy it in for some basic functionality and modularly ( is that a word ? ) manage each piece. That ( like your example ) is fine stuff. As a side note, I am sure large, large highly generalised programs are pretty hard to make. One thing I do is make each file have a null class like: # Empty object maker ( M T ) ... get it say it ! class MT(): pass # Hook point for this module generally mod = MT() Then, a category of symbols ( mostly 'variables ), grow under mod.(Whatever) # This window gets to exist, and it's exit via op sys clicks mod.ws = sb.make_Tk_Window( "seqdecodeshow" + str( a_Num ), gi.kCONFIGWIN ) This basic notion is that self.(stuff) is not quite multi class enough, yet 'global' is unpopular as a notation, due to name pollution. IN A BIG PROGRAM NOT A LITTLE WEENEY One YOU SCRATCH ON A BLACKBOARD SOMEPLACE !! Generally, The way I proceed is to try to avoid CLASSes in each module, but only a little. If you need it, you sure do. So early on ( like < 100 lines, if you avoided a class, roll back and add it ). Then, mod.(anything) is 'sort of' like self to class, but its politics is the filename that made it alone. If mod. is not used exactly in a class, roll it back to self. If its way more abstractley used, upgrade it to your concept of really global, which generally should be somewhat sparely used. All my TK calls are wrapped in a custom layer, it reduces the line count to 1/3. like so: sb.checkableBoole(cFrmL, 0, 0, gi.us, e_Txt, setting_ClickCb ) sb.textCmdLine( cFrmL, 1, 0, gi.us, 'Apply', applyThoseSelects ) sb.textCmdLine( cFrmL, 1, 1, gi.us, 'Reset', resetSelects ) sb.textCmdLine( cFrmL, 1, 2, gi.us, 'Select all', cbSelectAll ) cFrmL is the TK thing that contains these few text lines, with all the bg colors, whitepace, fonts, managed inside This calls 'grid' of course for placement. But all colors, and callbacks for changes are entirely in called pieces, which have been tested like 150% crazy. sb is import screenBuilder1 assb # Screen maker for TKinter and TKinter ++ windows If you want to use my 'screenbuilder'... talk to me, I suppose. this is a biology IDE, the screen part is just a little piece of a huge initiative. Obviously, the human being's ideas in there head matter so the TK stuff is important, to say the least Regs, Daniel B. Kolis my ref: 24 Jun 2023, https://groups.google.com/g/comp.lang.python/ -- https://mail.python.org/mailman/listinfo/python-list
