In my most recent posting, the code does exactly what I need it do...is there a way to get rid of the border/lighter gray area around the label? I want to only see the text.
Splitting tkinter canvas and frame apart
I have tried changing the label code to
v = Label(s, bg='gray',fg='black',borderwidth=0,highlightthickness=0,highlightcolor='gray',relief='sunken',anchor='w')
This still leaves the side borders that can be plainly seen in the code at the above link. I just inserted relief cause I saw someone else's post using it and thought I would give it a try versus leaving the relief flat as set by default. Made no difference.
How do I get rid of the light gray sides that are appearing on the Label. I know this is about to really become important probably as soon as this evening or tomorrow morning.
Related
I'm trying to many difficult solutions found all over the internet to fix a really easy problem, making my gif (an animated plot) wider in R Markdown, but there doesn't seem to be a way to do it that doesn't screw something up.
I have a gif of an animated plot that I made in R studio. Trying to change the width in R studio is a nightmare, if the aspect ratio is ever changed, then the white filler spaces become part of the plot, which is driving me crazy.
I am also unable to simply change the width within R Markdown, out.width changes both dimensions (makes it either tiny or huge without changing the actual ratio) and fig.width doesn't change anything.
Here is the simple code for including the gif in R Markdown
knitr::include_graphics("100m_animation.gif")
If anyone knows any way to simply change the width (make it longer), please let me know.
I have newly set up Linux Mint in my computer and learning wxpython(just because I was bored of tkinter and needed some rest from the headaches i got from creating large applications on it). I learned about first command 'TextCtrl'. Every thing works except I have a bit problem. the code is simple.
panel = wx.Panel(self)
wx.TextCtrl(panel, position=(10, 10), size=(250,150)
the code works fine except when I run it the cursor and the text appears to be in the middle(like vertically middle). Searched the damn internet, never found a simple solution. any guesses how can i align in to top in a single line of code?
screenshot
I think wx.Python will automatically align the text to the center in the vertical direction. If you need a wx.TextCtrl that big, I guess you want a multiline wx.TextCtrl. This you can get with the style parameter:
wx.TextCtrl(panel, position=(10, 10), size=(250,150), style=wx.TE_MULTILINE)
Scratch allows selection of the color using the set pen color. Does anyone know if its possible to program to set the color to transparent so that what ever is drawn can effectively be erased? What would the color number be for that?
Update
The idea was to cover a picture (background) with a colour drawn over the top. Now give the player a little creature that erases the colour on top, they have a certain amount of moves or time to guess what the picture is. The less moves/time they use the more points the player will be awarded.
But the problem seems to be that in the paint a sprite part of scratch erase is an option, but not in the pen programming.
If I cant solve it using erase apprach, my alternative is to make a lot of sprites covering the picture and hide them when the creature touches them. But it seems less fun for the player as the uncovered patterns will be more predictable.
Unfortunately, this isn't really possible. If you have a backdrop that's all one color, you could set the pen color to be the same as the backdrop and color over what you already have (giving the illusion of erasing), but other than that there really isn't a good way.
Your only other option is to use the clear block and then re-draw everything except the piece you want to erase.
If you want to give more context about your specific project, I might be able to help you work out a solution (I've done quite a lot with pen blocks over the years).
Like PullJosh said, it isn't really possible but you can make a sprite called Cover and make it a circle of any color you want. Then, it can clone it's sprite over the sprite you want to hide. Then you can attach a script to the clones:
https://i.stack.imgur.com/S6h4c.png (ctrl + click)
Recently ive been trying to create a small game using Pygame, Ive managed to display an image which can move side to side, the trouble ive been having is enabling it to fire bullets using the space bar.
Heres my code so far:
http://pastebin.com/24xDYwY7
Ive now got the bullet to display however it doesnt come out from the "turret.png", and just sits in the top left of the screen.
Is anyone able to help me with this? I am extremely new to python and would appreciate the help
It looks like you're using a technique I like employing in PyGame - using different sprite Groups for separating good guys, bad guys, bullets, blocks, etc… with a single unified 'all the things' Group.
What I don't see is the all_sprites.update() call that makes the whole thing work, though I do see player.update(). PyGame groups are designed to let you call group.update() in place of a for x in y call such as:
for sprite in my_sprites:
sprite.update()
EDIT: Not seeing your images in the right place? If they're being set to the upper-left corner, this is usually because nothing is setting the surface of the drawn image to appear where you want it to.
One thing I've found handy about PyGame's get_rect() call is that it allows you to pass arguments to set attributes of the rect you get back. For example, my sprite.draw(self) methods tend to look something like this:
def draw(self):
"""Sets the image's Rect to the middle of the sprite,
then blits to the screen.
"""
draw_rect = self.drawn_image.get_rect(center=self.rect.center)
SCREEN.blit(self.drawn_image, draw_rect)
This assumes that the sprite object's self.x and self.y are being updated correctly as well, but it's essentially the right thing to do; get the rect for the object you're drawing, set it to the right coordinates just as you do the actual sprite, then pass the image and the rect to SCREEN.blit().
I have previously used Mapquest Open Arial tiles without any trouble. However, after the last server change I get tiles with weird colors. Their example tile still looks fine:
http://otile1.mqcdn.com/tiles/1.0.0/sat/15/5240/12661.jpg
But, the ones I'm trying to download look like this:
http://otile1.mqcdn.com/tiles/1.0.0/sat/13/1927/3385.jpg
The most striking problem is that the vegetation is red.
Does anyone know what's causing this or perhaps how I can correct the colors (I have tried playing around with them a bit in gimp but I couldn't find a solution)?
Disclaimer: I work at MapQuest. Unfortunately there was bad data in the last round of open aerial imagery updates that caused some areas (we've noticed Texas) to be seeded with discoloration from zoom level 12 and up. We've got this on our backlog, but I don't have an estimate as to when this issue will be resolved. Thanks for your interest in our Open Tiles!