1. Tk Wrapper?

Hello all,

So I was recently looking into Tcl/Tk and I thought about making a wrapper using the Tk library. However upon further reading it appears that Tcl and tk are pretty intertwined with each other. However I know wrappers of tk exist for other languages, so it must be feasible for Euphoria, maybe. Though the C-API documentation is a little lacking in my opinion.

It looks like there was an old Tcl/Tk wrapper. However looking at the archives, the project dates back to 2008, so that would be pretty old. I took a look at the old wrapper and it looks like it didn't make a whole of progress, but could be a good place to start. Just wanting to hear thoughts if it would be worth it or too many hoops to jump through to get it working properly.

new topic     » topic index » view message » categorize

2. Re: Tk Wrapper?

Hi Andy

If you are looking for a need from people who will actually use it, I would say with the small user base that Eu has it would be a thankless task.

However, if you are doing entirely for your own need to 'climb it because it's there' then that is an admirable reason, and I would say definitely go for it. I for one follow you avidly, and am currently making heavy use of your SDL 2 library.

In short don't be disheartened by people not using your stuff, but just do it anyway.

As an aside, I just picked up a couple of VB6 for Dummies books - have you seen how fast that IDE starts?

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

3. Re: Tk Wrapper?

GTK is the best

Thankyou Irv.

tk/tcl works

The tcl/tk wrapper lets you write lets you write "tcl/tk" code inside OE|Phix and then execute it. You have to learn "tcl/tk" to use it. A wrapper from 2008, as good now as it was, because there is no language translation involved.

The "official" Python gui is a wrapper to tk. How they did this may give a clue to wrapping.

The gui results are dated in style.

Ok if you dont' mind running the tcl interpreter concurrently with OE|Phix. Since tk/tcl is often part of Linux, this does not seem offensive. (Japi|Java|OE does seem odd.)

No clue how one would reverse engineer tk to build a wrapper. If you could add some "polish" to the wrapper it would be appreciated.

Iup

Still a mystery to me how to get the .so files to load on Linux. Has anyone actually got this to work? Standing wishlist to get help on this.

be well
_tom

new topic     » goto parent     » topic index » view message » categorize

4. Re: Tk Wrapper?

ChrisB said...

Hi Andy

If you are looking for a need from people who will actually use it, I would say with the small user base that Eu has it would be a thankless task.

However, if you are doing entirely for your own need to 'climb it because it's there' then that is an admirable reason, and I would say definitely go for it. I for one follow you avidly, and am currently making heavy use of your SDL 2 library.

In short don't be disheartened by people not using your stuff, but just do it anyway.

As an aside, I just picked up a couple of VB6 for Dummies books - have you seen how fast that IDE starts?

Cheers

Chris

Its nice to see that some of my wrappers are being used. SDL2 was my first big wrapper project. I continue to update as SDL2 gets updated. I think my hope was that I would be able to make some pocket change from my wrappers, even if it was small donations through Paypal or Patreon. I have also made wrappers for other languages, my github has them if you wanna see. Yes VB6 IDE is very fast, much faster than Visual Basic.NET

As for Tk, I'll probably hold off on that. I should probably update my IUP wrapper. Its been awhile. I did use Win32lib heavily back in the day. However Win32lib is Windows only, though it is still a good library.

I don't know about getting the .so files loaded as I pretty much only use Windows. Once I upgrade to Windows 10, I plan on installing that Linux subsystem. The DLL seem to load fine regarding IUP for Windows.

new topic     » goto parent     » topic index » view message » categorize

5. Re: IUP and Linux

I have never had any problems following the installation instructions on the IUP site. I have only ever done this on Linux Mint, but it has been fine on the last few versions.

Let me know if you want me to check out precisely what the text says.

new topic     » goto parent     » topic index » view message » categorize

6. Re: IUP and Linux

dr_can said...

I have never had any problems following the installation instructions on the IUP site. I have only ever done this on Linux Mint, but it has been fine on the last few versions.

Let me know if you want me to check out precisely what the text says.

Running the IUP install script loads files as expected. These .so never load.

I am doing something fundamentally wrong, but can't figure out what.

Then I tried this test procedure:

  • I have Ubuntu and MX Linux on a 64bit computer. I have eui and phix.
  • I download lots versions of iup for Linux
  • I expand each download into a temp directory, and test if I can open the .so files
  • To test the compatibility (kernel, IUP version) I run this program (with small changes to make eui and phix work)
-- run in directory containing the .so files 
 
--include std/dll.e 
--include std/filesys.e 
 
? "hello" 
 
sequence path 
    path = current_dir() & "/" 
 
 
sequence so = { 
"libiup.so", 
"libiupcd.so", 
"libiupcontrols.so", 
"libiupgl.so", 
"libiupglcontrols.so", 
"libiupim.so", 
"libiupimglib.so", 
"libiup_mglplot.so", 
"libiup_plot.so", 
"libiup_scintilla.so", 
"libiuptuio.so", 
"libiupweb.so", 
$} 
 
 
for i=1 to length(so) do 
? open_dll( path &  so[i] ) 
end for 
  • The only .so that I can load is "libiup.so" and get a ref number, all the other .so return zero 0.

be well
_tom

new topic     » goto parent     » topic index » view message » categorize

7. Re: IUP and Linux

Try putting them into /usr/lib64 and running 'sudo ldconfig' or 'sudo ldconfig /usr/lib64'.
I'm not an expert on these matters but that seemed to do the trick for me. (I did 2nd first & don't know if 1st would suffice)
(Fairly obviously you will probably need to remove 'path' from that test program.)

Like you, I'm crying out for help in knocking the linux install notes into shape.

new topic     » goto parent     » topic index » view message » categorize

8. Re: IUP and Linux

petelomax said...

Try putting them into /usr/lib64 and running 'sudo ldconfig' or 'sudo ldconfig /usr/lib64'.
I'm not an expert on these matters but that seemed to do the trick for me. (I did 2nd first & don't know if 1st would suffice)
(Fairly obviously you will probably need to remove 'path' from that test program.)

Like you, I'm crying out for help in knocking the linux install notes into shape.

Testing on:

  • ubuntu xfce
  • mx kde

My IUP process.

  • download from sourceforge IUP linux runtime
  • open terminal
  • $ sudo ./install
    • enter root pswd
  • examine /usr/lib64 (ok)
  • $ sudo ldconfig /usr/lib64
  • test installation
? open_dll( "libiup.so" ) 
? open_dll( "libiupcontols.so" ) 

Result is:

  • libiup loads (regardless iup version and linux mix)
  • libiupcontols returns 0

be well
_tom

new topic     » goto parent     » topic index » view message » categorize

9. Re: IUP and Linux

_tom said...
petelomax said...

Try putting them into /usr/lib64 and running 'sudo ldconfig' or 'sudo ldconfig /usr/lib64'.
I'm not an expert on these matters but that seemed to do the trick for me. (I did 2nd first & don't know if 1st would suffice)
(Fairly obviously you will probably need to remove 'path' from that test program.)

Like you, I'm crying out for help in knocking the linux install notes into shape.

Testing on:

  • ubuntu xfce
  • mx kde

My IUP process.

  • download from sourceforge IUP linux runtime
  • open terminal
  • $ sudo ./install
    • enter root pswd
  • examine /usr/lib64 (ok)
  • $ sudo ldconfig /usr/lib64
  • test installation
? open_dll( "libiup.so" ) 
? open_dll( "libiupcontols.so" ) 

Result is:

  • libiup loads (regardless iup version and linux mix)
  • libiupcontols returns 0

be well
_tom

Run this:

ldd /usr/lib64/libiupcontols.so 

And look for any "not found" errors. These are missing dependencies you'll need to install. (Did you install the IUP "IM" and "CD" libraries?)

-Greg

new topic     » goto parent     » topic index » view message » categorize

10. Re: IUP and Linux

If you do as Greg advises you will discover that:

as well as downloading the various libiup*.so files you need a few more:

  • libcd.so needed for libiupcd.so
  • libftgl.so needed for libiupglcontrols.so and for libiup_plot.so
  • libim.so needed for libiupim.so
  • libcdgl.so and libcdcontextplus.so needed for libiup_plot.so

so you need to add material from "imtoolkit" and "canvasdraw" downloads as identified in the "Download Tips".

Only libim is from the first named; the others are all in "canvasdraw".

Notwithstanding these additions, all other libiup* files should have been found by open_dll, and were when I ran Tom's test on my Mint 20 setup, but, IMPORTANTLY(?), without the "path" reference.

Hope this helps you to get a fully working IUP environment.

new topic     » goto parent     » topic index » view message » categorize

11. Re: Tk Wrapper?

Icy_Viking said...

So I was recently looking into Tcl/Tk and I thought about making a wrapper using the Tk library. However upon further reading it appears that Tcl and tk are pretty intertwined with each other.

It seems you're correct about the two being intertwined. Tk is basically an instance of Tcl and the C API is just running Tcl commands into the interpreter.

Icy_Viking said...

However I know wrappers of tk exist for other languages, so it must be feasible for Euphoria, maybe.

Looking at the tkinter module for Python, you can see how they initialize a new Tkapp here:

https://github.com/python/cpython/blob/master/Modules/_tkinter.c#L693

Basically, you have to spin up a Tcl interpreter via Tcl_CreateInterp() and use that to create an application with Tcl_AppInit().

Icy_Viking said...

Though the C-API documentation is a little lacking in my opinion.

It's very lacking. Reminds of old Cisco documentation that just tells you what something is, and not why it is or how to use it. Dry, boring, and effectively useless.

What's really weird though, is that I can't seem to any tutorials online for the Tcl or Tk C APIs. Not even so much as a "Hello world!" app. Plenty of stuff for native Tcl or Python though.

Icy_Viking said...

It looks like there was an old Tcl/Tk wrapper. However looking at the archives, the project dates back to 2008, so that would be pretty old. I took a look at the old wrapper and it looks like it didn't make a whole of progress, but could be a good place to start.

I haven't looked at the existing wrapper, but Tcl and Tk don't seem to have changed a whole lot in the past... ever. So it may just need some tweaks to accommodate 64-bit memory access, etc.

I installed tcl8.6-dev and tk8.6-dev on my machine and had a look at the provided include files under /usr/include/tcl8.6.

It seems that everything is pretty straight-forward for a C API, no weird structs-by-value and what not.

The only problem is that the Tcl library is well over 500 functions! But I guess then we you could also utilize embedded Tcl scripts if you needed?

Icy_Viking said...

Just wanting to hear thoughts if it would be worth it or too many hoops to jump through to get it working properly.

I'll reiterate what Chris said: I'm sure someone might find it useful but nobody seems to be asking for it either. I think our efforts are best directed elsewhere.

-Greg

new topic     » goto parent     » topic index » view message » categorize

12. Re: Tk Wrapper?

Well Greg you make some good points. While it might prove useful to some, its probably not worth it. Plus with over 500 functions to wrap, it would be a big project. I did wrap SDL2, but that proved to be useful. I mostly focus on gaming related stuff, so it made sense to wrap SDL2, SFML and Raylib among the other libraries I have wrapped for Euphoria. If I find more gaming libraries that are feasible to wrap, I'll probably wrap. I tried wrapping TileEngine but for some reason it won't load images(through my wrapper), even though everything else works.

For now the most feasible way to wrap structs is if the structs themselves are simple, like struct vector2(float x, float y), I can just wrap as two C_FLOATS and take it from there.

new topic     » goto parent     » topic index » view message » categorize

13. Re: Tk Wrapper?

Thanks Greg...

On Linux MX19.3 I get "GLIBC_2.29' not found (required by /usr/lib64/libcd.so)" which is the major source of irritation.

Thanks Dr_can...

On Ubuntu, my only mistake is not downloading libcd, libim. I have not tried this since I gave up on 32bit.

As to TCL/TK...

An alternative gui would be "nice," but I get the impression that TKinter is not that well received in the Python world.

I will try to get past the IUP paper cuts and see how far I can get.

be well
_tom

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu