
Why do I get this 'tk' window?
Moderator: Kathy_9
-
terrypin
- Posts: 492
- Joined: Tue Jun 29, 2010 9:51 am
- System_Drive: C
- 32bit or 64bit: 64 Bit
- motherboard: Asus Z170 Pro 4
- processor: Intel Core i7 6700K 4.0GHz
- ram: 32 GB
- Video Card: None - uses built-in graphics
- sound_card: HD onboard sound card
- Hard_Drive_Capacity: 4.256 TB
- Monitor/Display Make & Model: iLyama Prolite E2403WS 24" 1920x1200
- Corel programs: Paint Shop Pro 8; Paint Shop Pro 2018
- Location: East Grinstead UK
Why do I get this 'tk' window?
While working on my novice scripts I sometimes get this 'tk' window after an error. It usually seems to be when my script is trying to use an empty clipboard. But I don't seem able to close it without restarting PSP 8.


--
Terry, East Grinstead, UK
Using PSP 8 & PSP 2018 under Win 10
Terry, East Grinstead, UK
Using PSP 8 & PSP 2018 under Win 10
-
LeviFiction
- Advisor
- Posts: 6831
- Joined: Thu Oct 02, 2008 1:07 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
- motherboard: Alienware M17xR4
- processor: Intel Core i7-3630QM CPU - 2_40GH
- ram: 6 GB
- Video Card: NVIDIA GeForce GTX 660M
- sound_card: Sound Blaster Recon3Di
- Hard_Drive_Capacity: 500GB
- Corel programs: PSP: 8-2023
- Location: USA
Re: Why do I get this 'tk' window?
PSP8 did not have access to the ctypes library, so when we made the pasting script we had to find another way. The only way to do that was to use the TKinter library. Unfortunately, it's not the best solution we could have come up with but it was necessary to automate pasting text as a text object. It seems the library doesn't respond well to being called via RunScript.
https://levifiction.wordpress.com/
-
terrypin
- Posts: 492
- Joined: Tue Jun 29, 2010 9:51 am
- System_Drive: C
- 32bit or 64bit: 64 Bit
- motherboard: Asus Z170 Pro 4
- processor: Intel Core i7 6700K 4.0GHz
- ram: 32 GB
- Video Card: None - uses built-in graphics
- sound_card: HD onboard sound card
- Hard_Drive_Capacity: 4.256 TB
- Monitor/Display Make & Model: iLyama Prolite E2403WS 24" 1920x1200
- Corel programs: Paint Shop Pro 8; Paint Shop Pro 2018
- Location: East Grinstead UK
Re: Why do I get this 'tk' window?
Thanks, understood. (Well, sort of!)
I've just noticed that a few of the scripts I use (made with help here, probably from you, a year or two ago) have 'from Tkinter import Tk' at their start:
And at the end I see:
Cannot test right now, but could that have been added to deal with this issue?
I've just noticed that a few of the scripts I use (made with help here, probably from you, a year or two ago) have 'from Tkinter import Tk' at their start:
Code: Select all
from JascApp import *
from Tkinter import Tk
def ScriptProperties():
return {
'Author': u'Terry Pinnell',
'Copyright': u'',
'Description': u'',
'Host': u'Paint Shop Pro',
'Host Version': u'8.10'
}
def Do(Environment):
# EnableOptimizedScriptUndo
App.Do( Environment, 'EnableOptimizedScriptUndo', {
})
Code: Select all
def getText():
r = Tk()
text = r.selection_get(selection='CLIPBOARD')
r.withdraw()
r.update()
r.destroy()
return text
--
Terry, East Grinstead, UK
Using PSP 8 & PSP 2018 under Win 10
Terry, East Grinstead, UK
Using PSP 8 & PSP 2018 under Win 10
-
LeviFiction
- Advisor
- Posts: 6831
- Joined: Thu Oct 02, 2008 1:07 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
- motherboard: Alienware M17xR4
- processor: Intel Core i7-3630QM CPU - 2_40GH
- ram: 6 GB
- Video Card: NVIDIA GeForce GTX 660M
- sound_card: Sound Blaster Recon3Di
- Hard_Drive_Capacity: 500GB
- Corel programs: PSP: 8-2023
- Location: USA
Re: Why do I get this 'tk' window?
Code: Select all
from Tkinter import Tk
#normal Script code here
def getText():
r = Tk()
text = r.selection_get(selection='CLIPBOARD')
r.withdraw()
r.update()
r.destroy()
return text
https://levifiction.wordpress.com/
-
terrypin
- Posts: 492
- Joined: Tue Jun 29, 2010 9:51 am
- System_Drive: C
- 32bit or 64bit: 64 Bit
- motherboard: Asus Z170 Pro 4
- processor: Intel Core i7 6700K 4.0GHz
- ram: 32 GB
- Video Card: None - uses built-in graphics
- sound_card: HD onboard sound card
- Hard_Drive_Capacity: 4.256 TB
- Monitor/Display Make & Model: iLyama Prolite E2403WS 24" 1920x1200
- Corel programs: Paint Shop Pro 8; Paint Shop Pro 2018
- Location: East Grinstead UK
Re: Why do I get this 'tk' window?
Thanks, understood. I plan to work on it again later today but I think those lines are indeed for su scripts that do indeed use text from the clipboard.
--
Terry, East Grinstead, UK
Using PSP 8 & PSP 2018 under Win 10
Terry, East Grinstead, UK
Using PSP 8 & PSP 2018 under Win 10
