Python How to generate a tiling (in python if possible)

  • Thread starter Thread starter caffeinemachine
  • Start date Start date
  • Tags Tags
    Python
AI Thread Summary
The discussion centers around generating interactive polyomino figures, with a focus on using Python for GUI programming. The original poster expresses a desire to manipulate polyominoes using keyboard controls, specifically to translate them on a grid. Responses highlight the challenges of Python GUI development compared to more established languages like C++ and Java, noting that while Python has libraries like tkinter and Qt, they come with limitations and varying learning curves. The conversation also touches on the potential of using existing code, such as a Tetris program found on GitHub, to experiment with polyomino translations. The poster acknowledges the complexity of the code but remains optimistic about adapting it for their needs. Overall, the thread emphasizes the need for a user-friendly interface and the exploration of suitable programming tools for achieving interactive graphical presentations.
caffeinemachine
Gold Member
MHB
Messages
799
Reaction score
15
I was reading this wikiperdia article on polyminos (https://en.wikipedia.org/wiki/Polyomino).

The pictures look very nice. Example

View attachment 8921
I want to learn how to generate these figures myself in an interactive way.

Basically I want to start with a polymino and then I want to be able to translate (by unit distance up-down or left-right) this polymino by pressing arrow keys and place it at the desired location. Then I want to pick another copy of the same polymino and place it at another desired location and so on.

Can somebody please help me get started as to where can I learn this?

Can I implement this is python?

Thank you.
 

Attachments

  • 800px-Conway_criterion_false_negative_nonominoes.svg.png
    800px-Conway_criterion_false_negative_nonominoes.svg.png
    5.9 KB · Views: 124
Technology news on Phys.org
Well, you're going to need some serious GUI programming, unless you want to do it all in ASCII art, in which case it won't look like what you've got there. Python GUI dev is not as advanced as, say, LabVIEW or C++, but I have heard of a sort of WYSIWYG editor: Qt Designer, though that locks you into Qt as your GUI framework. I have a bit more experience with tkinter, but as far as I know, it doesn't have a WYSIWYG editor. Most people don't do heavy GUI development in Python (a major area for future growth, in my opinion: the Python folks need to get this aspect of Python out there and competing): they turn to C++ or Java, where the tools are undeniably more mature (though I have to say, GUI development in LabVIEW has spoiled me for anything else; I don't know of any GUI development that is as fast as LabVIEW).

My current impression is that tkinter is a little faster development initially, but not as full-featured. Qt is a steeper learning curve, but has more features, plus you might be able to leverage Qt Designer to help out.

Does that answer your question?
 
Do you want a nice user interface with mouse and/or keyboard?
Or just a nice graphical presentation?
Or ability to run algorithms that 'solve' it?

Python is not particularly good at a mouse and/or keyboard interface.
It has some reasonable libraries for graphical presentations.
And it can run algorithms just fine, although for high complexity algorithms a lower level language may be desired.

Personally I like Qt with C++ that can do all of it, but as Ackbach already said, it has a steep learning curve.
So you may prefer python to get some results pretty quick.
A java development environment may be a good fit.
Unfortunately I do not have much experience with GUI programming in java, so I cannot recommend the best tool for it.
 
Ackbach said:
Well, you're going to need some serious GUI programming, unless you want to do it all in ASCII art, in which case it won't look like what you've got there. Python GUI dev is not as advanced as, say, LabVIEW or C++, but I have heard of a sort of WYSIWYG editor: Qt Designer, though that locks you into Qt as your GUI framework. I have a bit more experience with tkinter, but as far as I know, it doesn't have a WYSIWYG editor. Most people don't do heavy GUI development in Python (a major area for future growth, in my opinion: the Python folks need to get this aspect of Python out there and competing): they turn to C++ or Java, where the tools are undeniably more mature (though I have to say, GUI development in LabVIEW has spoiled me for anything else; I don't know of any GUI development that is as fast as LabVIEW).

My current impression is that tkinter is a little faster development initially, but not as full-featured. Qt is a steeper learning curve, but has more features, plus you might be able to leverage Qt Designer to help out.

Does that answer your question?

Thanks for the response. I have never done GUI programming before and all I can muster is a nervous laughter in response to the myriad of languages you are familiar with. I will try to see if I can use LabVIEW.

Thanks.

- - - Updated - - -

Klaas van Aarsen said:
Do you want a nice user interface with mouse and/or keyboard?
Or just a nice graphical presentation?
Or ability to run algorithms that 'solve' it?

Python is not particularly good at a mouse and/or keyboard interface.
It has some reasonable libraries for graphical presentations.
And it can run algorithms just fine, although for high complexity algorithms a lower level language may be desired.

Personally I like Qt with C++ that can do all of it, but as Ackbach already said, it has a steep learning curve.
So you may prefer python to get some results pretty quick.
A java development environment may be a good fit.
Unfortunately I do not have much experience with GUI programming in java, so I cannot recommend the best tool for it.

Thanks for replying.

I want to be able to control the tiles (polyminos) using the keyboard. I do not an algorithm which solves the tiling problem, though that would be awesome.

I just got hold of a tetris programme in python written by someone who has freely distributed it on github. I am trying to tinker with the code to switch gravity off and have fun with translations!
 
caffeinemachine said:
I want to be able to control the tiles (polyminos) using the keyboard. I do not an algorithm which solves the tiling problem, though that would be awesome.

I just got hold of a tetris programme in python written by someone who has freely distributed it on github. I am trying to tinker with the code to switch gravity off and have fun with translations!

That sounds as if you already have what you are looking for.
 
Klaas van Aarsen said:
That sounds as if you already have what you are looking for.
Yeah think so. However, the code is arcane (to me) and it will take some time before I can figure out what needs to be changed in the code to adapt to my purpose.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top