How to generate a tiling (in python if possible)

  • Thread starter caffeinemachine
  • Start date
  • Tags
    Python
In summary, the conversation revolves around the topic of learning how to generate polymino figures in an interactive way. The individual wants to be able to translate and place polyminos using arrow keys and is seeking help on how to learn this. They ask if it is possible to implement this in Python and receive responses recommending different GUI frameworks and languages such as LabVIEW, C++, and Java. The conversation also touches on the use of mouse and keyboard interfaces and running algorithms for solving the polyminos.
  • #1
caffeinemachine
Gold Member
MHB
816
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: 71
Technology news on Phys.org
  • #2
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?
 
  • #3
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.
 
  • #4
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!
 
  • #5
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.
 
  • #6
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.
 

1. How do I generate a tiling using python?

To generate a tiling in python, you can use the turtle module which provides a simple and intuitive way to draw geometric shapes. You can also use the matplotlib library to create more complex and visually appealing tilings.

2. What is the process for creating a tiling in python?

The process for creating a tiling in python involves defining the basic shape or motif, determining the size and layout of the tiles, and using loops and conditional statements to repeat and arrange the tiles to form the desired tiling pattern.

3. How can I customize the tiling pattern in python?

There are many ways to customize a tiling pattern in python. You can change the shape, size, and orientation of the tiles, add different colors or patterns, and even incorporate user input to create dynamic and interactive tilings.

4. Are there any existing libraries or packages for generating tilings in python?

Yes, there are several libraries and packages available for generating tilings in python. Some popular ones include pythonturtle, turtleart, and pycairo. These libraries provide a variety of tools and functions to help you create and manipulate tilings.

5. Can I export my tiling as an image or save it as a file using python?

Yes, you can export your tiling as an image or save it as a file using python. The matplotlib library allows you to save your tiling as a high-quality image file in various formats such as png, jpeg, and svg. You can also use the pil library to save your tiling as a .gif file.

Similar threads

  • Programming and Computer Science
Replies
1
Views
726
  • Programming and Computer Science
Replies
8
Views
873
  • Programming and Computer Science
Replies
1
Views
2K
Replies
6
Views
1K
  • Programming and Computer Science
Replies
5
Views
1K
Replies
17
Views
7K
  • Programming and Computer Science
Replies
15
Views
1K
Replies
10
Views
668
  • Programming and Computer Science
Replies
2
Views
2K
Replies
15
Views
5K
Back
Top