- Posts: 5
- Thank you received: 0
Axis Modifications
- nawaf
- Offline
- New Member
-
Less
More
1 year 9 months ago #318500
by nawaf
Replied by nawaf on topic Axis Modifications
Hi, BigJohnT,
Thank you for the information about axis modification.
I have a question regarding 'Changing the size of the file open dialog.' I followed the instructions and successfully resized it.
However, is it possible to also change the size of the 'Open' and 'Cancel' buttons? How can I adjust their size?
Thank you for the information about axis modification.
I have a question regarding 'Changing the size of the file open dialog.' I followed the instructions and successfully resized it.
However, is it possible to also change the size of the 'Open' and 'Cancel' buttons? How can I adjust their size?
Please Log in or Create an account to join the conversation.
- cakeslob
- Offline
- Platinum Member
-
Less
More
- Posts: 927
- Thank you received: 280
1 year 9 months ago #318600
by cakeslob
Replied by cakeslob on topic Axis Modifications
hmm i never realized thats what it meant, adjust the file dialog box.
I dont know how, but I want to know how. to resize buttons and everything else. or, even replace it with a different file dialog
I found the lib file that it uses
github.com/tcltk/tk/blob/main/library/tkfbox.tcl
github.com/tcltk/tk/blob/main/library/tkfbox.tcl#L446
here is the button
but now I dont know how to configure it in the bigfile.tcl
I dont know how, but I want to know how. to resize buttons and everything else. or, even replace it with a different file dialog
I found the lib file that it uses
github.com/tcltk/tk/blob/main/library/tkfbox.tcl
github.com/tcltk/tk/blob/main/library/tkfbox.tcl#L446
here is the button
Code:
set data(okBtn) [::tk::AmpWidget ttk::button $f2.ok \
-text [mc "&OK"] -default active];# -pady 2p]
bind $data(okBtn) <Destroy> [list ::tk::dialog::file::Destroyed $w]
set data(cancelBtn) [::tk::AmpWidget ttk::button $f2.cancel \
-text [mc "&Cancel"] -default normal];# -pady 2p]
but now I dont know how to configure it in the bigfile.tcl
Please Log in or Create an account to join the conversation.
- phillc54
- Offline
- Platinum Member
-
Less
More
- Posts: 5711
- Thank you received: 2100
1 year 9 months ago - 1 year 9 months ago #318684
by phillc54
Replied by phillc54 on topic Axis Modifications
ttk buttons have no height or width configuration options so in this instance the easiest way is to add newlines and spaces around the text.
Something like the below inserted immediately before the return should look reasonable.
Something like the below inserted immediately before the return should look reasonable.
Code:
after 0 {.__tk_filedialog.contents.f2.ok configure -text "\n Open \n"
.__tk_filedialog.contents.f2.cancel configure -text "\nCancel\n"
}
Last edit: 1 year 9 months ago by phillc54.
Please Log in or Create an account to join the conversation.
- cakeslob
- Offline
- Platinum Member
-
Less
More
- Posts: 927
- Thank you received: 280
1 year 9 months ago #318714
by cakeslob
Replied by cakeslob on topic Axis Modifications
that works, thanks phil.
when I say works, only the first time you open a filedialog (or multiple times within 1-2 seconds of opening axis) then it stops working.
putting this line in my userlive_update makes it work only sometimes
possibly need to do a python instead having it inside of a separate tcl file?
when I say works, only the first time you open a filedialog (or multiple times within 1-2 seconds of opening axis) then it stops working.
Code:
root_window.tk.call("source","bigfileopen.tcl")
possibly need to do a python instead having it inside of a separate tcl file?
Please Log in or Create an account to join the conversation.
- phillc54
- Offline
- Platinum Member
-
Less
More
- Posts: 5711
- Thank you received: 2100
1 year 9 months ago #318719
by phillc54
Replied by phillc54 on topic Axis Modifications
Ahh, yes I see that now. There are a couple of procedures in tkfbox.tcl that overwrite the button text.
The only correct way I see to do it would be to roll your own dialog box.
There is an ugly workaround by running the below code in the user_live_update method of the user command file. You would restore bigfileopen.tcl back to the original.
It is really ugly...
The only correct way I see to do it would be to roll your own dialog box.
There is an ugly workaround by running the below code in the user_live_update method of the user command file. You would restore bigfileopen.tcl back to the original.
Code:
def user_live_update():
if root_window.tk.eval('winfo exists .__tk_filedialog') == '1':
open = '\n Open \n'
cancel = '\nCancel\n'
root_window.tk.eval(f'.__tk_filedialog.contents.f2.ok configure -text {{{open}}}')
root_window.tk.eval(f'.__tk_filedialog.contents.f2.cancel configure -text {{{cancel}}}')
It is really ugly...
The following user(s) said Thank You: nawaf
Please Log in or Create an account to join the conversation.
- phillc54
- Offline
- Platinum Member
-
Less
More
- Posts: 5711
- Thank you received: 2100
1 year 9 months ago #318910
by phillc54
Replied by phillc54 on topic Axis Modifications
I really didn't like the last one so I tried something different and this is the result.
You don't need user_live_update, just use the below in bigfileopen.tcl.
You don't need user_live_update, just use the below in bigfileopen.tcl.
Code:
# bigfileopen.tcl
if {[info proc tkgof] == ""} {rename tk_getOpenFile tkgof}
proc tk_getOpenFile {args} {
# get width and height for max screen size:
variable width [lindex [wm maxsize .] 0]
variable height [lindex [wm maxsize .] 1]
# alternately, just set width and height explicitly:
variable width 800
variable height 600
# location on screen:
variable xoffset 0
variable yoffset 0
# padding to enlarge buttons:
variable padx 10
variable pady 20
# set the window size and the button sizes
after 0 {wm geometry .__tk_filedialog ${width}x${height}+${xoffset}+${yoffset};
.__tk_filedialog.contents.f2.ok configure -padding [list $padx $pady $padx $pady];
.__tk_filedialog.contents.f2.cancel configure -padding [list $padx $pady $padx $pady]}
return [eval ::tkgof $args]
}
The following user(s) said Thank You: tommylight, nawaf
Please Log in or Create an account to join the conversation.
Time to create page: 0.174 seconds