Skulpt support for TkInter

441 views
Skip to first unread message

Ajit Jaokar

unread,
Sep 8, 2013, 2:30:13 AM9/8/13
to sku...@googlegroups.com
Hello
Does Skulpt support TkInter? https://wiki.python.org/moin/TkInter
On first impressions, it does not. Any workarounds or suggestions?
many thanks

Brad Miller

unread,
Sep 15, 2013, 10:07:58 PM9/15/13
to sku...@googlegroups.com, Ajit Jaokar
You are correct that skulpt does not support Tkinter.  My question would be why would you want to have TkInter in a browser application?  Skulpt does have reasonable access to the DOM, so you can use regular html widgets for your interface, so that may be a partial workaround, again depending on what you have in mind.

--
Brad Miller
Associate Professor, Computer Science

--
 
---
You received this message because you are subscribed to the Google Groups "Skulpt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skulpt+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ajit Jaokar

unread,
Sep 16, 2013, 1:34:24 AM9/16/13
to sku...@googlegroups.com, bone...@gmail.com
Thanks Brad
In the UK, TkInter is used in many educational institutions and also in books (for learning Python)
Hence the request
Do you know if there are any plans to support it?
many thanks
kind rgds
Aji

Austin Bart

unread,
Nov 23, 2014, 10:35:25 PM11/23/14
to sku...@googlegroups.com, bone...@gmail.com, ajit....@futuretext.com
Have there been any further plans about this? I was thinking about adding in some limited support into my own instance of Tkinter for educational purposes. Are there any existing efforts to do so?

~Cory

Victor Norman

unread,
Oct 29, 2015, 1:04:41 PM10/29/15
to Skulpt, bone...@gmail.com, ajit....@futuretext.com
We are interested in having Tkinter supported too.  We are trying to build a framework where students' CS1 projects (written in Python with Tkinter and/or turtles) will be showcased for everyone to browse and enjoy.  

Will it be an impossible task to add Tkinter support to skulpt?  The main page shows that something like matplotlib has been added, and matplotlib is a pretty large and complication module.  So, I assume something like Tkinter could be added.

We're just wondering how feasible it is.

Vic

Brad Miller

unread,
Oct 29, 2015, 2:20:21 PM10/29/15
to sku...@googlegroups.com

I think it is a do-able project, given that some parts of the Tk model are just thrown out. The idea of a root window does not make much sense in the context of a browser for example. But other stuff could be done. My guess is that it would be a layer on top of standard input elements and canvas drawing operations. I’m not likely to be the person who implements it as I just have too much other stuff on my plate, but I would be happy to accept a PR.

Brad



-- 
Brad Miller
Sent with Airmail
For more options, visit https://groups.google.com/d/optout.

Victor Norman

unread,
Oct 29, 2015, 3:45:32 PM10/29/15
to sku...@googlegroups.com
Any hints on how to get started porting Tkinter over to work with Skulpt?  

Do we have to hand port Tkinter.py over javascript?

Also:

I notice that one of the first things that Tkinter.py does is 

import _tkinter

which, on my machine, comes from lib-dynload/_tkinter.so

According to https://wiki.python.org/moin/TkInter, _tkinter is an extension module implemented in C.

Are we going to have to find the source code for that and port it over to javascript?  

Thanks.

--

---
You received this message because you are subscribed to a topic in the Google Groups "Skulpt" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skulpt/eZRqlWIvmYE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skulpt+un...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
“A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away.” -- Antoine de Saint Exupéry

Brad Miller

unread,
Oct 29, 2015, 4:52:11 PM10/29/15
to sku...@googlegroups.com

Yeah, Tkinter is based on Tk as in Tcl/Tk so it is using the underlying libraries from having Tk installed.

So, to me, a ‘port’ never made sense. However something that works like Tk would make some sense. I’m really curious about your use cases for this. If it is to do simple drawing, then why not use processing or something that is already working. If you want to make GUI’s with buttons and stuff in a fake window in a browser? Then making a Tk workalike that simple uses document.CreateElement(‘input’) behind the scenes makes a lot more sense than reimplementing Tk to the point where you are drawing your own buttons.

Brad



-- 
Brad Miller
Sent with Airmail

Victor Norman

unread,
Oct 29, 2015, 5:30:38 PM10/29/15
to sku...@googlegroups.com
Our use cases are that we already have a bunch of code from CS1 students who have written cool little final projects in python + Tkinter.  Our goal is to build a framework that allows us to deploy a website where visitors can run these final projects in the browser.

We can choose to only "post" the projects that use one window -- I don't want to deal with projects that pop up multiple Tk main windows, dialog boxes, etc...  

And, I don't want to rewrite the students' projects to use some different library.  I was hoping we could get Tkinter widgets to display in a main window in the browser.

Vic

Brad Miller

unread,
Oct 29, 2015, 5:47:54 PM10/29/15
to sku...@googlegroups.com

What I was trying to say was that I think your best option is going to be to implement the Tkinter API but use the tools you have in Javascript. This would let you run the Tkinter programs they have written but would work in the browser. I think that trying to reimplement all of Tkinter down to the level of its primitive drawing methods would take a really long time, and it seems a bit pointless as you already have buttons and labels and text input widgets, a canvas, etc that you can use.

Brad



-- 
Brad Miller
Sent with Airmail

Victor Norman

unread,
Oct 29, 2015, 5:56:04 PM10/29/15
to sku...@googlegroups.com
Ah.  OK.  That is going to be some bit of work...  I assume that means we rewrite Tkinter.py (plus more) in javascript.  That means my students are going to have to learn some serious javascript...

There isn't some tool that converts a python file to javascript is there?  Please say yes!  :-)


Victor Norman

unread,
Oct 29, 2015, 6:22:26 PM10/29/15
to sku...@googlegroups.com
Another possibility I've been thinking about is running the student's Python+Tkinter code on a remote machine and doing single-window VNC sharing to the web browser...  Then, we could also share projects written in C++ or Java from our CS2 or CS3 courses.

Brad Miller

unread,
Oct 29, 2015, 11:07:39 PM10/29/15
to sku...@googlegroups.com
Ok, Yes. That is what skulpt does. 🙂

Sent from my iPad

chris...@katyisd.org

unread,
May 2, 2018, 2:24:37 PM5/2/18
to Skulpt
Did anything ever happen with tkinter?  Thanks.

Victor Norman

unread,
May 2, 2018, 3:57:50 PM5/2/18
to sku...@googlegroups.com
What happened is that I had students write a system where you can run any program and display its output over the network in a browser -- and interact with the program.

The system is called Agora.  You can see it demonstrated here: http://agora.cs.calvin.edu:8080   Note that when you click on a project, you are actually starting it up on the remote linux machine, and getting the input/output sent across into your browser.  A very cool idea, I think. 

It is on github, too.

i'd love to see more people deploy it.

Vic


To unsubscribe from this group and all its topics, send an email to skulpt+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Austin Bart

unread,
May 2, 2018, 6:10:18 PM5/2/18
to Skulpt
Well, that's nice to know. However, I was hoping to hear if there'd be any further development of Skulpt support for TKinter. It'd be a nifty thing, for sure - although I do recognize that there could be other advancements too.
Reply all
Reply to author
Forward
0 new messages